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

whats the diff bw the evaluate also and and?

0 Answers   CGI,


What is a Proc ? why do we go for a Proc ? What are the types of procs?Can we have nesting in Procs ?

9 Answers   Xansa,


i have 1000 records in input file and i want to sort it and the first 200 records to be placed in output file. how to do that??

14 Answers   L&T,


jcl is like a complier....?

6 Answers  


what is the use of IEBGENER utility?

0 Answers  






I have an job having three job steps.Suppose i want to call a pgm in step2 and aproc in step3.How to write the code?

2 Answers   IBM,


WHAT IS DUMMY IN JCL? HOW TO USE IT? CAN ANYBODY SEND PROGRAM ON THIS?

3 Answers  


how to purge 50 initiators continuously?? console commands??

4 Answers   IBM, ups,


What statement marks the beginning of a job step; assigns a name to the step; identifies the program or catalogued or in-stream procedure to be executed in the step?

0 Answers  


Hi Please try to be to-the-point. 1) How to INCLUDE a JCL segment in a JOB ? (A Small example) 2) What is SPOOL and what is SPOOL FULL ? and how to direct the output of a Jobstep to SPOOL ?

3 Answers   IBM,


How to read and write a single record into a file. I would like to use it to enter a single 8-character piece of information and use it to put it into a variable for processing in JCL. Thank you

0 Answers  


What is model dataset label(Model DSCB)?

1 Answers  


Categories