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
How to remove the spaces at end of each record in the output file Via COBOL program? note: The file has a VB length ----TRY
What is the function of dd name parameter with a 2 part structure; audit.report?
how to run batch program without jcl?
Give the syntax of job specifying jcl statement.
i want to store 20 digits . how will u do it in cobol ?
in ways data can be passed to a COBOL program from JCL?
Must tape dataset definitions include vol=ser specifications?
What are steplib and joblib? What for they are used?
Explain about ISPF/TSO Commands
write a jcl to execute a job by 7:00 am on jan 20,1986?
what is the compile process of cobol program expalin with code
Suppose I have five jobs to do. But I want to hold one?
what is “Cond= even” and “Cond=only”?
How to run cobol program using jcl?
My Question is 1. How to cound no. of records in JCL. Please explain with an example. 2. How to execute only odd steps in JCL? I know EDIT TYPE = Inculde, Step Name = 1,3,5 and COND code for all even step. Anyone knows other than this.