I have a file in which I have 20 records. I want my first
record to go into file 1 and second record to go in second
file. I want to copy the alternate records like this in the
two output files. How can I do this using JCL?

Answer Posted / muttaiah

Adding to satish answer.

Option copy is similar to sort fields= copy or merge
fields=copy.
It is used to simply copy the records from input to output
file.

Outfil is used when we want to do process records in the
input file.
Here split option is used in Outfil to seperate the input
file into 2, that means it will write the alternate records
into the files specified in fnames.
Other syntax of Outfill would be

//step1 exec pgm=sort
//sortin dd dsn=Inputfile
//sortof01 dd dsn=file1
//sortof02 dd dsn=file2
//sysin dd *
option copy
outfil files=(01,02),split
/*
Here we are giving 01,02 which indicates the DDnames that
are prefixed with sortof.

Hope this makes sense in understanding satish answer

@All: Do correct me if i'm wrong.

Thank u

Is This Answer Correct ?    5 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

if we want to use a gdg which is already created by some job, then how to use the reference of the last generation in a jcl?

1629


How to pass data to a program that is coded in an exec statement?

845


I have a cobol db2 program(PGM A) where other program (PGM B) will call this program and passes some 50 fields data to PGM A. PGM A has some layout in which it receives the data from PGM B. And this layout has been copied in the linkage section pf PGM A. After getting the data, PGM A writes the data in a flat file in the same layout which it receives from PGM B. PGM B is a simple COBOL pgm. Please provide a JCL to run these programs.

1740


What is concatenating?

647


Explain the function of //cntl statement?

666






What does a disposition of (MOD,DELETE,DELETE) mean ?

676


Can an individual step be restricted from using all the jobs allowed cpu time?

1021


What is the purpose of dd?

735


hello friends ,i have exam in Hsbc,pls any on send me placement papers and technical questions on mainframes,thank u

1678


Explain dfsort utility?

683


I want my job (careerride) to be executed in 1 minute and 2 seconds. How do I do that?

721


Explain how can the disposition of sysout datasets be set for an entire jobstream?

644


how you can direct the data to spool using SYSOUT option?

935


Where & How Do You Code Identifier In Jcl?

710


I have a job called careerride and some steps in it as step1,step2. But I want to execute step2 before step1 ? How do I do that?

844