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 |
hi iam learning mainframes,can anybody tell me how to check JCL errors.(after submiting the JCL we have check in spool or is there any other method)
I have a COBOL program that ACCEPTs some input data. How do you code the JCL statement for this?
How can I write the joblog in the spool on normal end of a job step and direct the joblog to a dataset only if the step abends?
how can we pass parameters from JCL to cobol subprogram...my requirement is i should not get data from mainprogram but i need it from JCL directly
Is it possible to take a PDS and write it to a GDG? If so, can you provide an example? Thanx
What you mean by skeleton JCl?
what disp parameter we mention for creation of temporary dataset so that we can use it in later steps?
Explain how can return codes be tested before execution of a job step?
I have two input SORTIN files and We need to create one SORTOUT file which contains data of both input files. What is the SortCard for this?. Suppose the length of the both files are different, then How we do it? Please reply ASAP
What is a S0C4 error ?
What is the use of DSNDB07 ?
have in 100 records in a file i want to read first 3 records and skip next 3 records and agan i want to read 3 records and again i want to skip 3 records... run a loop from record one to 10 evaluate i/3 if comes even then skip else write to output file