I have a sequential file in which there are 50 records. Now
I want to copy all the 50 records in the reverse order into
a new file? The last record in the original file should be
the first record in the new file. How can I do it?
Answer Posted / avinashn17
The above soultion works only if records are in the sorted
order.
The below piece of code could be used for records which are
not sorted.
******************************************************
//STEP1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=INPUT,
// DISP=SHR
//SORTOUT DD DSN=OUTPUT,
// DISP=(NEW,CATLG,DELETE),
// DCB=(DSORG=PS,RECFM=FB,LRECL=80,BLKSIZE=0),
// DATACLAS=PSFB
//SYSIN DD *
INREC OVERLAY=(81:SEQNUM,8,ZD)
SORT FIELDS=(81,8,ZD,D)
OUTREC BUILD=(1,80)
/*
*********************************************************
Record length of the above file is 80
INREC OVERLAY - places sequence number after 80.
Then it is sorted in descending order of sequence nummber.
OUTREC BUILD - removes sequence number and retains original
record.
| Is This Answer Correct ? | 13 Yes | 1 No |
Post New Answer View All Answers
Explain how can a jobs execution priority be modified?
How can an in-stream dataset be terminated?
what happens in execution stage in job processing?
what JCL Procedures?
what is the use of JCL?
List the different components of jcl statement?
How does the jcl specify the job to os?
In job processing, what happens in execution stage?
What is the format of comment statement?
List the various advantages of using jcl language?
State the uses of syspring, sysin, sort fields, sum fields and dummy.
How jcl work to handle various input output file operations?
What dd statement is used to supply the name of a dataset?
What do you understand by the term job time – out and how can you overcome that?
how can a gdg base be created in a jcl. What is the difference between empty and scratch parameter while defining/altering gdg base?