$EdScan

From m204wiki
Revision as of 19:56, 3 August 2017 by JAL (talk | contribs) (misc formatting)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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