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

What happens if both JOBLIB and STEPLIB is specified ?

8 Answers  


Is there a way to check for an empty file in JCL other than using IEBCOMPR and the command PRINT COUNT(1)?

8 Answers  


which statement is used to end the in-stream procedure in a jcl?

1 Answers   IBM,


In sms datasets, what is the function of the dd avgrec keyword?

0 Answers  


What is model dataset label(Model DSCB)?

1 Answers  






Could anyone please suggest me what is the maximum length of data that can be pass as input in //sysin dd * This was asked in interview. TIA

3 Answers   VC, Wipro,


how can we pass external data to instream procedures

5 Answers   IBM, Infosys, Ocwen,


what is full form of AIX

3 Answers   Accenture,


WORKING-STORAGE SECTION. 01 GROSS-PAY. 05 BASIC-PAY PIC 9(5). 05 ALLOWENCES PIC 9(3). PROCEDURE DIVISION. MOVE 1000 TO BASIC-PAY. MOVE 250 TO ALLOWENCES. DISPLAY GROSS-PAY. STOP RUN. 77 W-A PIC 9(3)V99 VALUE 23.75 77 W-B PIC ZZ9V99 VLAUE 123.45 after the statement MOVE W-A TO W-B what will be W-B's value? a.123.75 b.b23.75 (where b indicates space) c.023.75 d.invalid move

0 Answers  


If Name is NOT given for a JOB statement, then will it give error or installation will supply it for the JOB ?

1 Answers   IBM,


In my job I have 6 steps. Step01,02,03...step06. after executing step02 i want to skip step03 and want to execute step04. and once step04 is done then I want to go back and execute step03. once step03 is completed I want execute step05, 06 and so on... can any one tell me how do i do that???

10 Answers   Perot Systems,


What is the difference between primary and secondary allocations for a dataset?

8 Answers  


Categories