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

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,


how to run JCL thru COBOL.

1 Answers   Patni,


can we write a proc with in a proc

4 Answers   IBM,


What are the difference between jcl and jes?

0 Answers  


In SPACE,what is directory,RLSE

6 Answers   TCS,






What is the difference between joblib and jcllib statements

7 Answers   IBM, Maples,


Explain the function of //jcllib statement?

0 Answers  


What is the error/SOC code if dd names are not sysut1 and sysut2 in IEBGENER?

1 Answers   CTS,


i have a jcl calling proc which has 10 steps, i want to execute from step5 to step10, where can i code RESTART and COND parameter?

6 Answers   IBM,


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

2 Answers   IBM,


I have 5 steps in my job. say s1, s2, s3, s4, s5 //s1 exec ............. //s2 exec ............ //s3 exec .......... //s4 exec ........ //s5 exec ............... my question is i want to exeute only s2 and s4 steps... please advice me how to do this:

4 Answers   ITC Infotech, TCS,


TIME parameter in JOB statement or EXEC statement specifies What type of time (CPU time or execution time)?

5 Answers   CTS,


Categories