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


Please Help Members By Posting Answers For Below Questions

what are the statements that are not valid to be included in an include statement?

767


What is the function of the dd mgmtclas keyword in sms datasets?

728


What is the use of disp parameter?

643


Explain the function of dd name parameter with a 2 part structure; audit.report?

885


is there any way to execute more than one proc in the same exec statement at the same time..?

2100






Is it possible to define dd statements as you want?

640


What is the significance of addrspc parameter in exec statement?

724


in order to execute step2 a job after a return code of 8 in step1, what condition you will code in step2?

2046


hello friends ,i have exam in Hsbc,pls any on send me placement papers and technical questions on mainframes,thank u

1657


Are there any set of rules for the names of the steps used in a job?

625


List the different jcl statements that are not permitted in the procedures?

631


Is automatic restart possible in jcl?

722


1) SORT FIELDS=(20,4,CH,D,10,3,CH,D) OUTREC FIELDS=(7:20,4,C' FUTURE ',20,2,10,3,1Z,1,9,13,7, 24,57,TRAN=LTOU,6X'FF') This example illustrates how a fixed-length input data set can be sorted and reformatted for output. The SORTIN LRECL is 80 bytes. The reformatted output records are fixed length with a record size of 103 bytes. SOLRF (the IBM-supplied default) is in effect, so unless the SORTOUT LRECL is specified or available, it will automatically be set to the reformatted record length of 103. in the above example i have some doubts that a) sort fields=(20,4,CH,D,10,3,CH,D) -what exactly it does and this fields related to output record fields or input record fields b)outrec used to refprmat the records after sorting that means could please reply me as soon as possible Thanks. Venkat

7071


Is it possible to code instream data in a PROC?

740


What are steplib and joblib? What for they are used?

679