USER (US)
The USER function is a form of COPY that creates new records or data sets. USER allows greater control when writing output records and data sets. USER can perform three tasks:
- Insert new records at any point in a data set
- Repeat records with changed data
- Write multiple output datasets from a single input dataset.
New records are built by copying the input record, or by moving data to the output record with the MOVE parameter. File-AID automatically copies the input record to the output when executing a USER function, except when a MOVE parameter is used. With the MOVE parameter, File-AID initializes the output area to binary zeros, and assumes that the parameter statements build the entire record. (Use the PADCHAR parameter to override the default initialization value of binary zero.) If a location has no data moved to it, binary zeros remain. The output area is not reinitialized between writes.
The USER function always processes all parameter groups for each input record, as if the ALL modifier had been specified. Thus, USERALL is not valid.
Example 1:
Example 1 copies the input dataset and writes it to the data set defined with a DD name of OUTPUT.
Example 2:
Example 2 creates an extract file with the DD name of EXTRACT. This data set contains every tenth record on the input data set that contains a value not equal to the characters X,Y, or Z in location 40. A maximum of 25 records are written to the output extract file.
Example 3:
Example 3 repeats a record. The first WRITE parameter writes all input records to the output dataset with the DD name of A. The IF parameter selects any input record that contains the string CANCEL. The second WRITE parameter writes the record a second time.
Example 4:
MOVE=(21,P’155’),WRITE=NEWDSN
Example 4 repeats a record with changed data. The first WRITE parameter reads in a record and writes it out. The IF parameter checks to see if the record contains a packed decimal value of 5 beginning in location 21. The first MOVE parameter copies the input record to the output area. The second MOVE parameter moves the two-byte packed decimal value 155 to location 21. The second WRITE parameter then writes the newly built record to the output dataset with the DD name of NEWDSN.
Example 5:
MOVE=(1,80C’ ’),MOVE=(1,C’//SYSUDUMP DD SYSOUT=A’),
WRITE=NEWJCL
Example 5 builds and inserts new records at specific locations in an output dataset as it is copied from the input dataset. The IF, MOVE, and WRITE parameters are used to insert a SYSUDUMP DD statement after each EXEC statement in a JCL job stream.
The F(FORM) parameter tells File-AID to expect JCL data. The first WRITE parameter copies a complete JCL statement from the input dataset to the output dataset. The IF parameter locates any JCL statement that contains a character string EXEC in the first 20 locations of the statement. When an EXEC is found, the first MOVE parameter places 80 blanks in the output area. The second MOVE parameter loads the required data into the record. The second WRITE parameter writes the newly built record to the data set with the DD name of NEWJCL.