"EXECIO 1 DISKRU ..."
More about using DISKRU appears in “Updating Information in a Data Set” on
page 162.
How to access the data set: An I/O data set must first be allocated to a ddname.
The ddname need not exist previously. In fact, it might be better to allocate it to a
new ddname, such as MYINDD, in order not to interfere with previously established
allocations. You can allocate before the exec runs, or you can allocate from within
the exec with the ALLOCATE command as shown in the following example.
"ALLOC DA(io.data) F(myindd) SHR REUSE"
"EXECIO * DISKR myindd (FINIS"
Option of specifying a starting line number: If you want to start reading at other
than the beginning of the data set, specify the line number at which to begin. For
example, to read all lines to the data stack starting at line 100, add the following
line number operand.
"EXECIO * DISKR myindd 100 (FINIS"
To read just 5 lines to the data stack starting at line 100, write the following:
"EXECIO 5 DISKR myindd 100 (FINIS"
To open a data set at line 100 without reading lines to the data stack, write the
following:
"EXECIO 0 DISKR myindd 100 (OPEN"
Options for DISKR and DISKRU: Options you can use are:
v OPEN - To open a data set. When you specify OPEN with EXECIO 0, it opens
the data set and positions the file position pointer before the first record.
"EXECIO 0 DISKR myindd (OPEN"
Note: If the data set is already open, no operation is performed for OPEN.
v FINIS - To close the data set after reading it. Closing the data set allows other
execs to access it and its ddname. It also resets the current positional pointer to
the beginning of the data set.
v STEM - To read the information to either a list of compound variables that can be
indexed, or a list of variables appended with numbers. Specifying STEM with a
variable name ensures that a list of variables (not the data stack) receives the
information.
"EXECIO * DISKR myindd (STEM newvar."
In this example, the list of compound variables has the stem newvar. and lines of
information or records from the data set are placed in variables newvar.1,
newvar.2, newvar.3, and so forth. The number of items in the list of compound
variables is placed in the special variable newvar.0.
Thus if 10 lines of information are read into the newvar variables, newvar.0
contains the number 10, indicating that 10 records have been read. Furthermore,
newvar.1 contains record 1, newvar.2 contains record 2, and so forth up to
newvar.10 which contains record 10. All stem variables beyond newvar.10 (for
example, variables newvar.11 and newvar.12) are residual and contain the
value(s) held prior to entering the EXECIO command.
Using EXECIO to Process Information ...
156
z/OS V1R1.0 TSO/E REXX User’s Guide