Tags

, , , , , , , , , , ,

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:

Working on Mainframes – Is Change to a different technology necessary
Important SQL CODES and ABEND CODES
SORT JOIN – TO JOIN TWO FILES BASED ON A KEY
KNOW YOUR MAINFRAME
REXX – INITIAL SETUP
HOW TO SUBMIT A BATCH JOB FROM THE CICS PROGRAM
CICS – EXEC interface block – EIBRESP Values
CICS – EXEC interface block Fields
Flow of control between COBOL programs, run units, and CICS
CICS INTERVIEW QUESTIONS
CICS TIPS
COBOL – COPY and INCLUDE statements
COBOL – PERFORMANCE IMPROVEMENT
COBOL – SIGN STORED IN COMP, COMP-3 AND DISPLAY FORMATS
SHORTEST COBOL PROGRAM
RESTART LOGIC IN COBOL DB2 Program
GOBACK – EXIT PROGRAM – STOP RUN
Continuation lines in COBOL
Computational items – COMP, COMP 1 , COMP 2, COMP 3
COBOL program format
cobol indicator area column-7 and area a and area b
COBOL INTERVIEW QUESTIONS
COBOL TIPS
COBOL COMPILER OPTIONS
The IDENTIFICATION DIVISION