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



I have a sequential file in which there are 50 records. Now I want to copy all the 50 records in t..

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

I have a sequential file in which there are 50 records. Now I want to copy all the 50 records in t..

Answer / sanju

use sort card:
//SYSIN DD *
COPYBACK OUT=50
/*

Is This Answer Correct ?    4 Yes 0 No

I have a sequential file in which there are 50 records. Now I want to copy all the 50 records in t..

Answer / shammi

But COPYBACK option can be used using File aid only...

Is This Answer Correct ?    3 Yes 0 No

I have a sequential file in which there are 50 records. Now I want to copy all the 50 records in t..

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

Post New Answer

More JCL Interview Questions

//ERFDS JOB //STEP1 //STEP2 //STEP3...COND=(4,LT) //STEP4 1.CONDITION IN STEP3 REFERS TO WHICH STEP'S RETURN CODE (STEP1 OR STEP2)? 2.IN ABOVE PROGRAM IF CONDITION SATISFIES IN STEP3 WHICH STEPS WILL EXECUTE?? AND WHY? IF CONDITION IN STEP3 SATISFIES

5 Answers   IBM,


What is one line to pass PARM from JCL to COBOL?

0 Answers  


Name the statement which can be used to send data to another mvs jes3 node?

0 Answers  


how to identify a vasam dataset by seeing in 3.4(browse)

5 Answers   Cap Gemini,


wht do u mean by inrec and outrec ?

1 Answers   IBM,






How can unused space allocation be returned to the system when a dataset is closed?

0 Answers  


Hi Guyz, My requirement is to empty out a PS file but not to delete. How would I do that. Is there any Utility. If any other way, plz answer. Thanks.

9 Answers   iGate, Lehman Brothers,


List in order the hierarchical levels of jcl?

0 Answers  


What is the difference between BLKSIZE and LRECL?

3 Answers  


Name some of the JCL statements that are not allowed in procs.?

1 Answers  


what is the Difference between SYSIN and PARM ?

5 Answers   IBM,


can any one plzzzzzz tell the jcl code for creating ps using idcams

2 Answers   Fiserv,


Categories