Suppose i have a file with 10 recs and i want to skip only the
7 th record and copy the rest into another file. How do i do
it using SORT?
Answer Posted / rajiv
Hi,
you can do something like this using inrec & outfil
//STEP010 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
XXXX1 ABCEDFHIJCKLMO
XXXX2 ABCDEFGHIJKLMO
XXXX3 ABCDEFGHIJKLMO
XXXX4 ABCDEFGHIJKLMO
XXXX5 ABCDEFGHIJKLMO
XXXX6 ABCDEFGHIJKLMO
XXXX7 ABCDEFGHIJKLMO
XXXX8 ABCDEFGHIJKLMO
XXXX9 ABCDEFGHIJKLMO
XXX10 ABCDEFGHIJKLMO
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY,EQUALS
INREC IFTHEN=(WHEN=GROUP,RECORDS=10,PUSH=(21:SEQ=1))
OUTFIL INCLUDE=(21,1,CH,NE,C'7'),BUILD=(1,20)
Output:
XXXX1 ABCEDFHIJCKLMO
XXXX2 ABCDEFGHIJKLMO
XXXX3 ABCDEFGHIJKLMO
XXXX4 ABCDEFGHIJKLMO
XXXX5 ABCDEFGHIJKLMO
XXXX6 ABCDEFGHIJKLMO
XXXX8 ABCDEFGHIJKLMO
XXXX9 ABCDEFGHIJKLMO
XXX10 ABCDEFGHIJKLMO
Is This Answer Correct ? | 3 Yes | 0 No |
Post New Answer View All Answers
Is condition checking possible in jcl?
Explain how can the disposition of sysout datasets be set for an entire jobstream?
How do you create a temporary dataset?
what is DD statement is used in JCL?
what is the difference between JES3 and JES2?
Hello Guys, I have 1+ Year Experience in MAINFRAME TESTING. After 1 Week I have an Interview With a Company on Mainframe Testing. Please Could You Guys Please Suggest me What Sections Should I prepare ?? ___Tell Me the Topic Or Appropriate Site & Links. ?? ---------------Thank You
I have 60 steps in the JCL and want to Execute Only First from PROC by overriding in JCL ?
Must tape dataset definitions include vol=ser specifications?
How can return codes be tested before execution of a job step?
How do you submit a job for execution?
In sms datasets, what is the function of the dd avgrec keyword?
How to compare two files in SYNCSORT and on the mismatch record should be deleted from second file.
in ways data can be passed to a COBOL program from JCL?
Explain the function of a dd statement?
Explain the function of the steplib dd statement?