$EdScan: Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (misc formatting)
 
(4 intermediate revisions by one other user not shown)
Line 2: Line 2:
<span class="pageSubtitle">Scan list of entities in online</span>
<span class="pageSubtitle">Scan list of entities in online</span>


<p class="warn"><b>Note: </b>Most Sirius $functions have been deprecated in favor of Object Oriented methods. There is no OO equivalent for the $EdScan function.</p>
<p class="warn"><b>Note: </b>Most $functions have been deprecated in favor of Object Oriented methods. There is no OO equivalent for the $EdScan function.</p>


This function scans the list of defined entities in the online region. Entities can be 204 datasets, sequential files or streams, printers, punches or processes.  
This function scans the list of defined entities in the online region. Entities can be Model&nbsp;204 data sets, sequential files or streams, printers, punches or processes.  


The <var>$EdScan</var> function accepts four arguments and returns a number indicating the success of the function.
The <var>$EdScan</var> function accepts four arguments and returns a number indicating the success of the function.


==Syntax==
==Syntax==
<p class="syntax"><span class="term">%result</span> = <span class="literal">$EdScan</span>(<span class="term">image_name</span>, [<span class="term">type</span>], [<span class="term">scope</span>], [<span class="term">name</span>])
<p class="syntax"><span class="term">%result</span> = <span class="literal">$EdScan</span>(<span class="term">imageName</span>, [<span class="term">type</span>], [<span class="term">scope</span>], [<span class="term">name</span>])
</p>
</p>


<p>
<ul>
<var class="term">%result</var> is a 0 or to an error code.</p>
<li><var class="term">%result</var> is a 0 or to an error code.</li>


<ul>
<li><var class="term">imageName</var> is a string identifying an image to receive returned data. This image must have the following format :
<li>The first argument is a string identifying an image to receive returned data. This image must have the following format :
<p class="code"><nowiki>image entity
<p class="code">image entity
loopVar  is binary len 4
loopVar  is binary len 4
name    is string len 8
name    is string len 8
Line 50: Line 49:
terminal    is string len 8
terminal    is string len 8
end image
end image
</p>
</nowiki></p>
ALLOC will return either NEW, OLD or COND and DISP returns either SHARE or EXCL. This is a required argument.  
<p>
<code>alloc</code> returns NEW, OLD, or COND, and <code>disp</code> returns SHARE or EXCL. This is a required argument. </p></li>


<li>The second argument is a string indicating the type of entity for which information is to be returned. Valid types are
<li><var class="term">type</var> is a string indicating the type of entity for which information is to be returned. Valid types are:
<table class="syntaxTable">
<table class="thJustBold">
<tr><th>ALLOCATE</th>
<tr><th>ALLOCATE</th>
<td>Files allocated by the ALLOCATE command.</td></tr>
<td>Files allocated by the <var>ALLOCATE</var> command.</td></tr>
 
<tr><th>DATASET</th>
<tr><th>DATASET</th>
<td>Files defined by the DEFINE DATASET command.</td></tr>
<td>Files defined by the <var>DEFINE DATASET</var> command.</td></tr>
 
<tr><th>PRINTER</th>
<tr><th>PRINTER</th>
<td>Printers defined by the DEFINE PRINTER command.</td></tr>
<td>Printers defined by the <var>DEFINE PRINTER</var> command.</td></tr>
 
<tr><th>PUNCH</th>
<tr><th>PUNCH</th>
<td>Punches defined by the DEFINE PUNCH command.</td></tr>
<td>Punches defined by the <var>DEFINE PUNCH</var> command.</td></tr>
 
<tr><th>STREAM</th>
<tr><th>STREAM</th>
<td>Files defined by the DEFINE STREAM command.</td></tr>
<td>Files defined by the <var>DEFINE STREAM</var> command.</td></tr>
 
<tr><th>PROCESS</th>
<tr><th>PROCESS</th>
<td>Processes defined by the DEFINE PROCESS command.
<td>Processes defined by the <var>DEFINE PROCESS</var> command. </td></tr>
</td></tr></table>
</table>
This is an optional argument.  
<p>
This is an optional argument. </p></li>


<li>The third argument is a string indicating the scope of the entities for which information is to be returned. Valid scopes are 'SYSTEM' and 'USER'. This is an optional argument. If not specified, all entities are returned.  
<li><var class="term">scope</var> is a string indicating the scope of the entities for which information is to be returned. Valid scopes are 'SYSTEM' and 'USER'.  
<p>
This is an optional argument. If not specified, all entities are returned. </p></li>


<li>The fourth argument is the name of the entity for which information is to be returned. This is an optional argument but if it is specified, arguments 2 and 3 are also required.
<li><var class="term">name</var> is the name of the entity for which information is to be returned. This is an optional argument, but if it is specified, arguments 2 and 3 are also required. </li>
</ul>
</ul>


In the image indicated by argument 1, LOOP_VAR must be set to the number of entries matching the selection criterion that are to be skipped. Upon return, <var>$EdScan</var> will set LOOP_VAR to the number of entries skipped plus one if an entity is returned and to the number of entries skipped if not. Thus, multiple invocations of <var>$EdScan</var> without setting LOOP_VAR will return information on all appropriate entities.
In the <var class="term">imageName</var> image, <code>loopVar</code> must be set to the number of entries matching the selection criterion that are to be skipped. Upon return, <var>$EdScan</var> sets <code>loopVar</code> to the number of entries skipped plus one (if an entity is returned) or to the number of entries skipped (otherwise). Thus, multiple invocations of <var>$EdScan</var> without setting <code>loopVar</code> return information on all appropriate entities.


===Status codes===
===Status codes===
<p class="code"> 0 - Entity found, image set
<p class="code"> 0 - Entity found, image set
  4 - Entity not found, or off end of chain
4 - Entity not found, or off end of chain
  8 - Invalid argument 1 or argument 2
8 - Invalid argument 1 or argument 2
12 - Argument 4 specified without argument 2 or 3
12 - Argument 4 specified without argument 2 or 3
16 - Image specified by argument 1 not found
16 - Image specified by argument 1 not found
20 - Image specified by argument 1 not active, or too short
20 - Image specified by argument 1 not active, or too short
</p>
</p>


Line 90: Line 98:


<p class="code">begin
<p class="code">begin
image junk
image junkEntity
var is binary len 4
var is binary len 4
  ...
  ...
end image
end image
   
   
prepare image junk
prepare image junkEntity
repeat forever
repeat forever
   %rc = $edScan('junk', 'ALLOCATE', 'SYSTEM')
  <!-- Note that the first arg is intentionally shown with different casing than the image declaration: -->
   %rc = $edScan('junkentity', 'ALLOCATE', 'SYSTEM')
   if %rc then
   if %rc then
       stop
       stop
Line 117: Line 126:
<li>[[Media:SirfieldNew.pdf|Sir2000 Field Migration Facility]]</li>
<li>[[Media:SirfieldNew.pdf|Sir2000 Field Migration Facility]]</li>
</ul>
</ul>
<p>
</p>


[[Category:$Functions|$EdScan]]
[[Category:$Functions|$EdScan]]

Latest revision as of 19:56, 3 August 2017

Scan list of entities in online

Note: Most $functions have been deprecated in favor of Object Oriented methods. There is no OO equivalent for the $EdScan function.

This function scans the list of defined entities in the online region. Entities can be Model 204 data sets, sequential files or streams, printers, punches or processes.

The $EdScan function accepts four arguments and returns a number indicating the success of the function.

Syntax

%result = $EdScan(imageName, [type], [scope], [name])

  • %result is a 0 or to an error code.
  • imageName is a string identifying an image to receive returned data. This image must have the following format :

    image entity loopVar is binary len 4 name is string len 8 scope is string len 6 type is string len 8 * This section used just for DATASET + ALLOCATE: dsname is string len 44 dsorg is string len 10 alloc is string len 4 disp is string len 5 * This section just used for PRINTER + PUNCH: class is string len 1 route is string len 8 id is string len 8 dist is string len 8 forms is string len 8 * This section just used for LINK: transport is string len 8 at dsname protocol is string len 8 * This section just used for PROCESS: destination is string len 8 at dsname partner is string len 10 mode is string len 4 * This section just used for PROCESSGROUP: link is string len 8 at dsname remoteid is string len 8 terminal is string len 8 end image

    alloc returns NEW, OLD, or COND, and disp returns SHARE or EXCL. This is a required argument.

  • type is a string indicating the type of entity for which information is to be returned. Valid types are:
    ALLOCATE Files allocated by the ALLOCATE command.
    DATASET Files defined by the DEFINE DATASET command.
    PRINTER Printers defined by the DEFINE PRINTER command.
    PUNCH Punches defined by the DEFINE PUNCH command.
    STREAM Files defined by the DEFINE STREAM command.
    PROCESS Processes defined by the DEFINE PROCESS command.

    This is an optional argument.

  • scope is a string indicating the scope of the entities for which information is to be returned. Valid scopes are 'SYSTEM' and 'USER'.

    This is an optional argument. If not specified, all entities are returned.

  • name is the name of the entity for which information is to be returned. This is an optional argument, but if it is specified, arguments 2 and 3 are also required.

In the imageName image, loopVar must be set to the number of entries matching the selection criterion that are to be skipped. Upon return, $EdScan sets loopVar to the number of entries skipped plus one (if an entity is returned) or to the number of entries skipped (otherwise). Thus, multiple invocations of $EdScan without setting loopVar return information on all appropriate entities.

Status codes

0 - Entity found, image set 4 - Entity not found, or off end of chain 8 - Invalid argument 1 or argument 2 12 - Argument 4 specified without argument 2 or 3 16 - Image specified by argument 1 not found 20 - Image specified by argument 1 not active, or too short

Example

The following program prints the DD and DSNAME of all ALLOCATE'd datasets.

begin image junkEntity var is binary len 4 ... end image prepare image junkEntity repeat forever %rc = $edScan('junkentity', 'ALLOCATE', 'SYSTEM') if %rc then stop end if print %junk:name and %junk:dsname end repeat end

Products authorizing $EdScan