OVERLAY the field values using DFSORT utility, I have explained with a simple example.
Mainframe how they work.
//SYSIN DD * * Skip the first three records OPTION SKIPREC=3 * Keep records that meet the specified * field-to-field or * field-to-constant selection criteria INCLUDE COND=(7,5,PD,LE,22,5,PD,OR, 25,3,CH,EQ,C'J69') * Add a sequence number to the * remaining records. INREC OVERLAY=(73:SEQNUM,8,ZD) * Sort the records. SORT FIELDS=(20,8,ZD,A,11,2,CH,D) * Produce one record for each unique * sort key with totals * for the specified summary fields SUM FIELDS=(45,4,BI,8,2,PD) * Produce output records displaying * the sort and sum fields * intermixed with constants * and arithmetic operations. OUTREC BUILD=(8C'0',20,8,ZD, M11,4X,11,2,4C'*', 45,4,BI,M11,4X,8,2,PD,M11, ((32,6,PD,MUL,-50),ADD,58,3,ZD), M11,LENGTH=8, 73,8) * Produce three output data sets * from one pass over the input OUTFIL FNAMES=(OUT1,OUT2,OUT3) /*
Detailed Explanation for Overlay
Using OVERLAY, you reformat each record by specifying just the items that overlay specific columns.
OVERLAY lets you change specific existing columns without affecting the entire record. In the below example:
Starts from position 45, and length 8, translating lower case to upper case. This example clearly tells how we can use Overlay.
One of the frequently asked interview Question, in IBM, Tech Mahindra, CTS, and Dell. Why means all financial projects using Sort, to sort all reports.
The OVERLAY you can apply in both the INREC and OUTREC formattings.