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?

1609


What is the function of the dd dcb keyword?

814


State the uses of syspring, sysin, sort fields, sum fields and dummy.

638


how do you access an uncataloged dataset in a jcl?

821


How to compare two files in SYNCSORT and on the mismatch record should be deleted from second file.

5053






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

597


how can the same proc be re-used and called by many jobs?

898


How to execute 2nd and 4th steps among 5 steps in jcl proc?

742


How would you understand error(execution phase)?

617


In sms datasets, what is the function of the dd mgmtclas keyword?

852


What is the function of //jcllib statement?

791


What is the function of job statement in jcl?

629


How jcl work to handle various input output file operations?

652


what is use of dsn parameter in dd statement?

662


Immediate Job opening for mainframe professionals in Keane Bangalore. Please find the below details: Organization: Keane India Location: Bangalore Skill: COBOL, JCL,VSAM,DB2,CICS,IMS,REXX,CLIST Exp: 1 to 4 years only Employment Type: Permenant Employee Note: If you have attended keane interview in past 6 months please ignore this job opening. Please respond to email id keanemfjob@gmail.com OR keanemfjob@yahoo.in with your latest resume and following details, We will contact you within 24 hours: Total IT Exp: Exp in Mainframe: Current CTC: Expected CTC: Notice Period:

3521