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
Suppose I have a program in cobol name ”careerride” and want to execute the program by jcl. Specify the process?
Explain how can the disposition of sysout datasets be set for an entire jobstream?
When The Define Jcl Is Not Available, How Can You Get Information About A Vsam File's Organisation ?
What is the purpose of the dd keylen parameter?
What is NOTCAT ?
How can the attributes of one sms dataset be copied to another dataset?
Explain the purpose of dd dummy statement?
What is the purpose of disp parameter?
How do you access an uncatalogued dataset in a jcl?
write a jcl to execute a job by 7:00 am on jan 20,1986?
Why block size is multiple of lrecl in jcl?
I have a cobol db2 program(PGM A) where other program (PGM B) will call this program and passes some 50 fields data to PGM A. PGM A has some layout in which it receives the data from PGM B. And this layout has been copied in the linkage section pf PGM A. After getting the data, PGM A writes the data in a flat file in the same layout which it receives from PGM B. PGM B is a simple COBOL pgm. Please provide a JCL to run these programs.
Where & How Do You Code Identifier In Jcl?
What do you know about jcl?
what is the purpose of coding notify parameter in job statement?