When we receive files from a different system, we had to copy only certain lines into a different file for processing. These certain lines are identified by a string (keyword) at a position. Once the line where this string is available is identified, requirement is to copy the next 5 lines (including the line that has the string) into the output dataset.
Below SORT card can be used for this purpose (Input file LRECL is 80 and keyword string is ‘PAYROLL’)
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,80,SS,EQ,C’PAYROLL’),
RECORDS=5,PUSH=(81:ID=1))
OUTFIL BUILD=(1,80),OMIT=(81,1,CH,EQ,C’ ‘)
————————————————————————————————————–
If you would like to Earn Free Stocks, Credit card Points and Bank account Bonuses, Please visit My Finance Blog
You may also like to look at: