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?
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / shammi
But COPYBACK option can be used using File aid only...
| Is This Answer Correct ? | 3 Yes | 0 No |
Answer / avinash n
The file could be sorted in the descending order.
Synatx:
SORT FIELDS=(1:Y,CH,D)
where Y = record length.
The output would be in the reverse order!
| Is This Answer Correct ? | 0 Yes | 13 No |
Is there a limit of 3273 DD statements for a JCL or for every EXEC step in a JCL?
I have 15 flat files. each record in the files have the monthly salary for 12 months with the employee number. Now I want to concatenate the 15 files such that for the employee numbers that are common the o/p file should have only one record and the salaries should be concatenated to that record. How can we do it with JCL?
in jcl you are having JCLLIB and STEPLIB what happens
what is a jcl?
can we maintain 2 generations with different Lengths in Same GDG ?
how to convert a file form fixed Length to variable length?
How do you pass parameters to the program as the job is being executed ?
if we give TIME=0 how many sec that job/step
Is automatic restart possible in jcl? If yes, how?
We have an output dataset in job with disp parameter as SHR. Can we write data in that file dataset?
Is there any command to check wether the ps file is in sorted order?
Explain COND used in JCL?