Copying an Entire Data Set
"ALLOC DA(my.input) F(datain) SHR REUSE"
"ALLOC DA(new.input) F(dataout) LIKE(my.input) NEW"
"NEWSTACK" /* Create a new data stack for input only */
"EXECIO * DISKR datain (FINIS"
QUEUE '' /* Add a null line to indicate the end of the information */
"EXECIO * DISKW dataout (FINIS"
"DELSTACK" /* Delete the new data stack */
"FREE F(datain dataout)"
If the null line was not queued at the end of the information on the stack, the
EXECIO command would go to the terminal to get more information and would not
end until the user entered a null line.
Another way to indicate the end of the information when copying an entire data set,
is with the QUEUED() built-in function. If the data set is likely to include null lines
throughout the data, using the QUEUED() function is preferable.
n = QUEUED() /* Assign the number of stack items to "n" */
"EXECIO" n "DISKW dataout (FINIS"
Also, when copying an undetermined number of lines to and from the data stack, it
is a good idea to use the NEWSTACK and DELSTACK commands to prevent
removing items previously placed on the stack. For more information about these
commands, see “Protecting Elements in the Data Stack” on page 147.
Copying a specified number of lines to a new data set: To copy 10 lines of
data from an existing sequential data set named 'DEPT5.STANDARD.HEADING' to
a new member in an existing PDS named 'USERID.OFFICE.MEMO(JAN15)', and
use the ddnames INDD and OUTDD respectively, you could use the following
instructions. (Remember that a data set name that does not begin with your prefix
must be enclosed in single quotes.)
Copying 10 Lines of Data to a New Data Set
"ALLOC DA('dept5.standard.heading') F(indd) SHR REUSE"
"ALLOC DA(office.memo(jan15)) F(outdd) SHR REUSE"
"EXECIO 10 DISKR indd (FINIS"
"EXECIO 10 DISKW outdd (FINIS"
To copy the same 10 lines of data to a list of compound variables with the stem
"data.", substitute the following EXECIO commands.
"EXECIO 10 DISKR indd (FINIS STEM DATA."
"EXECIO 10 DISKW outdd (FINIS STEM DATA."
Note: When copying information to more than one member of a PDS, only one
member of the PDS should be open at a time.
Adding 5 lines to the end of an existing sequential data set: To add 5 lines
from an existing data set member named 'USERID.WEEKLY.INPUT(MAR28)' to the
end of an existing sequential data set named 'USERID.YEARLY.OUTPUT', and use
the ddnames MYINDD and MYOUTDD respectively, you could write the following
instructions. Note the "MOD" attribute on the second allocation, which appends the
5 lines at the end of the data set rather than on top of existing data.
Using EXECIO to Process Information ...
160
z/OS V1R1.0 TSO/E REXX User’s Guide