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
Explain about ISPF/TSO Commands
Where & How Do You Code Identifier In Jcl?
What do you understand by the term “keyword” with respect to jcl and what is the opposite of the term?
Which statement is used to identify the private libraries in job?
Explain how can a jobs execution priority be modified?
How to find the UNIT and VOLUME of a (a) KEPT (b) UNCATALOGED and (c) CATALOGED dataset - using (i) JCL and using (ii) ISPF ?
I have a COBOL program that ACCEPTs some input data. How do you code the JCL statement for this?
Explain how can return codes be tested before execution of a job step?
How do you overcome this limitation ?
What does a disposition of (MOD,DELETE,DELETE) mean ?
if the submitter of a job wants to inform another user about the job completion, how can it be done?
How to execute 2nd and 4th steps among 5 steps in jcl proc?
What are the parameter we cannot use in procedure? How many instream we can write in single jcl?
whats the diff bw the evaluate also and and?
How can the attributes of one sms dataset be copied to another dataset?