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 are the 4 fields in dd statement?

0 Answers  


Where can program checkpoints be stored for use in a restart?

0 Answers  


shall we concordinate two different length dataset in to a new date set.

6 Answers  


How to change default PROCLIB?

1 Answers  


diff bw vsam and normal flat file?

2 Answers   CGI,






What is the meaning of the EXEC statement keyword, COND? What is its syntax?

2 Answers  


What is the difference between catalogue procedure and In-Stream procedure?

2 Answers  


How do you check the syntax of a JCL without running it?

17 Answers  


What will happen if two JOB statements are mentioned in an JCL continuously.

2 Answers   IBM,


in job stmt i coded time=(2,30) and in step 1 i coded time=(1,30) and in step i coded time=(1,30), whch one executes first and what happens if step1 and step2 time executes and wht about the remaining time if step and step2 executes

4 Answers  


Can we use COND=EVEN on a job card, when jobs are scheduled through scheduler?

1 Answers   L&T,


What is the purpose of the PARM keyword in the EXEC statement?

3 Answers  


Categories