I have two files each contains 10 records. I would like to
copy both files into one output file but in alternate
sequence. for e.g. first record from file1 then record 2
from file2.....

Answers were Sorted based on User's Feedback



I have two files each contains 10 records. I would like to copy both files into one output file bu..

Answer / mallikharjuna

it will be processed in 3steps
if the data is AAA
AAA
BBB
CCC

FILE2
DDD
EEE
FFF
LIKE 10 RECS

step1:
srt fields=copy
outrec fields=(1:1,3,4:seqnum,4,ZD,START=1,INCR=2 )

STEP:2

step2:
srt fields=copy
outrec fields=(1:1,3,4:seqnum,4,ZD,START=2,INCR=2 )


STEP=3 SORT FIELDS = COPY
OUTREC FIELDS =(1:1,3)

Is This Answer Correct ?    9 Yes 0 No

I have two files each contains 10 records. I would like to copy both files into one output file bu..

Answer / muttaiah

Mallikarjuna,

If you give sort=copy in step3. the format of o/p file is
rec1 - File1
rec2 - File1
Rec1 - File2
rec2 - File2

change the sort as:
sort fields=(4,4,ZD,A)
outrec fields=(1:1,3)
rec1 - File1
Rec1 - File2
rec2 - File1
rec2 - File2

Is This Answer Correct ?    6 Yes 0 No

I have two files each contains 10 records. I would like to copy both files into one output file bu..

Answer / aks

Use df sort utility and use infile and outfile for writing
the record into output file.

Is This Answer Correct ?    1 Yes 1 No

Post New Answer

More JCL Interview Questions

What is the function of dd name parameter with a 2 part structure; audit.report?

0 Answers  


Is it possible to take a PDS and write it to a GDG? If so, can you provide an example? Thanx

7 Answers  


Explain about ISPF/TSO Commands

0 Answers  


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

0 Answers  


how you will the direct the data to spool using sysout option?

0 Answers   IBM,






I have one GDG. Everyday One new version is being created.Now I want to split this created version in different files each having 1000 records. Here Problem is I don't know How many records will be there in new version of GDG? that's why I don't know How many Out files we need to use . Interesting??????????????

4 Answers   CTS,


IN MY JCL I VE 8 STEPS I WANT TO EXCUTE STEP 8 FIRST THEN EXCUTE STEP 4 ,HOW WILL EXCUTE STEP 8 BEFORE STEP 4?

7 Answers   Cognizant, IBM, IGT,


i want to restart frm step 2, previously i coded cond parameter on step2 wht happens at tht time ?

4 Answers   Infosys,


Hi, all suppose i have 5 steps (S1,S2,S3,S4,S5) what will happen if cond is true or false (which of the other steps get executed)? 1) //s3 exec pgm=abc,cond=(0,le) 2) //s3 exec pgm=abc,cond=(0,le,step2) 3) In the jobcord RESTART=step3,cond=(0,le) 4) can i code COND=TRUE in jobcard, if yes what will happen?

3 Answers   TCS, Tech Mahindra,


using cursor how can you fetch more than one record into a variable

3 Answers   Syntel,


can we write a proc with in a proc

4 Answers   IBM,


a dd statement has 2 types of parameters. Name them?

0 Answers  


Categories