Copying data
By default, the DSC (Data Set Copy) function simply copies the contents of one data set to another (using DFSORT if available). The following excerpt from a batch job enhances the DSC function to:
- Include in the input stream only those records whose first two characters are “01” or “02”.
- Add two lines to SYSPRINT that tally the total values of the “salary” (a 4-byte packed decimal field found at position 27) and “month 1 payment” (a 4-byte binary field found at position 31) fields in the “01”-type records.
- In each output record, change the first occurrence of “Grant Smith” to “Fred Bloggs”.
- Write only those records whose first two characters are “02” to the default output data set (DDOUT), adding a sequence field in 1-6 and shifting the rest of the data over.
- Write to another data set (OUT01) only those records whose first two characters are “01”, unchanged.
- Print the first ten output records (to SYSPRINT) in hexadecimal format.