In one of intervie, my interviwer asked, I have a file
which contains 4 records I would like to split the 4
different outputs for each record how to do?

Answers were Sorted based on User's Feedback



In one of intervie, my interviwer asked, I have a file which contains 4 records I would like to sp..

Answer / kiran

You can use OUTFIL's SPLIT parameter to put the first
record into OUTPUT1, the second record into OUTPUT2, the
third record into OUTPUT1, the fourth record into OUTPUT2,
and so on until you run out of records. SPLIT splits the
records one at a time among the data sets specified by
FNAMES. The following statements split the records between
two OUTFIL data sets:
OPTION COPY
OUTFIL FNAMES=(Op1.op2,op3,op4),SPLIT
Similarly, OUTFIL's SPLITBY=n parameter splits the records
n at a time among the data sets specified by FNAMES. The
following statements split the records four at a time
between three OUTFIL data sets:

OPTION COPY
OUTFIL FNAMES=(OUT1,OUT2,OUT3),SPLITBY=4

Is This Answer Correct ?    14 Yes 1 No

In one of intervie, my interviwer asked, I have a file which contains 4 records I would like to sp..

Answer / ajay

You can do through DF SORT .
See the below Example.

OUTFIL FNAMES=OUTDD1,INCLUDE=(POS,LENGTH,COND,CONDVALUE)
OUTFIL FNAMES=OUTDD2,INCLUDE=(POS,LENGTH,COND,CONDVALUE)
OUTFIL FNAMES=OUTDD3,INCLUDE=(POS,LENGTH,COND,CONDVALUE)

Is This Answer Correct ?    13 Yes 2 No

In one of intervie, my interviwer asked, I have a file which contains 4 records I would like to sp..

Answer / aarti sharma

Sort utility could be used for this with the OUTFIL option.
In your case you will have to mention 4 outfil op
OUTFIL RECORDS=(POS,LENGTH,COND,CONDVALUE) OUTIL=PS1
PS1 would be the outdataset need to define in DD stmt. In
ur case you need to have 4 outfil stmts mentioning 4
outfile record..
Not sure about the syntax..

Is This Answer Correct ?    10 Yes 0 No

In one of intervie, my interviwer asked, I have a file which contains 4 records I would like to sp..

Answer / bjoern

//REPRO EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//IN DD DISP=OLD,DSN=IN
//OUT1 DD DISP=OLD,DSN=OUT1
//OUT2 DD DISP=OLD,DSN=OUT2
//OUT3 DD DISP=OLD,DSN=OUT3
//OUT4 DD DISP=OLD,DSN=OUT4
//SYSIN DD *
REPRO IFILE(IN) OFILE(OUT1) COUNT(1)
REPRO IFILE(IN) OFILE(OUT2) SKIP(1) COUNT(1)
REPRO IFILE(IN) OFILE(OUT3) SKIP(2) COUNT(1)
REPRO IFILE(IN) OFILE(OUT4) SKIP(3)

Is This Answer Correct ?    7 Yes 1 No

In one of intervie, my interviwer asked, I have a file which contains 4 records I would like to sp..

Answer / rookie

//**********************************************************

//STEP0011 EXEC PGM=SORT

//SORTIN DD DSN= <input file>,DISP=SHR

//SORTOFO1 DD DSN= <output file 1>,DISP=.....,
// SPACE=(....),
// DCB=....
//SORTOFO2 DD DSN= <output file 1>,DISP=.....,
// SPACE=(....),
// DCB=....
//SORTOFO3 DD DSN= <output file 1>,DISP=.....,
// SPACE=(....),
// DCB=....
//SORTOFO4 DD DSN= <output file 1>,DISP=.....,
// SPACE=(....),
// DCB=....
//*

//SYSIN DD *

OUTFIL FILES=(1,2,3,4),SPLITBY=1

/*
//

Is This Answer Correct ?    2 Yes 0 No

In one of intervie, my interviwer asked, I have a file which contains 4 records I would like to sp..

Answer / rajesh

The following will also work ..

//SYSIN DD *
SORT FIELDS=COPY,
OUTFILE FNAMES=(OUTFILE1,OUTFILE2,OUTFILE3,OUTFILE4),SPLIT
/*

Is This Answer Correct ?    2 Yes 0 No

In one of intervie, my interviwer asked, I have a file which contains 4 records I would like to sp..

Answer / priyanka

//**********************************************************
//STEP0011 EXEC
PGM=SORT
//SORTIN DD DSN= <input file>
//
DISP=SHR
//SORTOFO1 DD DSN= <output file 1>,
// DISP=
(NEW,CATLG,DELETE),
// SPACE=(CYL,
(10,10),RLSE)
//SORTOFO2 DD DSN= <output file 2>,
// DISP=
(NEW,CATLG,DELETE),
// SPACE=(CYL,
(10,10),RLSE)
//SORTOFO3 DD DSN= <output file 3>,
// DISP=
(NEW,CATLG,DELETE),
// SPACE=(CYL,
(10,10),RLSE)
//SORTOFO4 DD DSN= <output file 4>,
// DISP=
(NEW,CATLG,DELETE),
// SPACE=(CYL,
(10,10),RLSE)
//*

//SORTWK01 DD SPACE=(CYL,
(100,50)),UNIT=SYSDA
//SORTWK02 DD SPACE=(CYL,
(100,50)),UNIT=SYSDA
//SYSOUT DD
SYSOUT=*
//SYSIN DD
*
SORT FIELDS=
(01,3,CH,A)
OUTFIL FILES=O1,INCLUDE=
(01,3,CH,EQ,C'USA'),CONVERT,OUTREC=(4,062)
OUTFIL FILES=O2,INCLUDE=
(01,3,CH,EQ,C'CAN'),CONVERT,OUTREC=(4,062)
OUTFIL FILES=O3,INCLUDE=
(01,3,CH,EQ,C'CHE'),CONVERT,OUTREC=(4,062)
OUTFIL FILES=O4,INCLUDE=
(01,3,CH,EQ,C'GBR'),CONVERT,OUTREC=(4,062)
/*

//**********************************************************

Is This Answer Correct ?    1 Yes 0 No

In one of intervie, my interviwer asked, I have a file which contains 4 records I would like to sp..

Answer / hi

one more way to do this!!!

//JOB12345 JOB (DVLP,TEST),'CUTSDC',CLASS=N,MSGCLASS=X
//*
//STEP01 EXEC PGM=IDCAMS
//*
//SYSPRINT DD SYSOUT=*
//INFILE DD DSN=IN,DISP=SHR
//OUTFILE DD DSN=OUT1,
// DISP=(NEW,CATLG,DELETE),
// DCB=(RECFM=FB,LRECL=179),SPACE=(CYL,
(20,20),RLSE),
// UNIT=SYSDA
//SYSIN DD *
REPRO INFILE(IN) -
OUTFILE(OUT1) -
SKIP(0) -
COUNT(1)
//STEP02 EXEC PGM=IDCAMS
//*
//SYSPRINT DD SYSOUT=*
//INFILE DD DSN=IN,DISP=SHR
//OUTFILE DD DSN=OUT2,
// DISP=(NEW,CATLG,DELETE),
// DCB=(RECFM=FB,LRECL=179),SPACE=(CYL,
(20,20),RLSE),
// UNIT=SYSDA
//SYSIN DD *
REPRO INFILE(IN) -
OUTFILE(OUT1) -
SKIP(1) -
COUNT(1)
//STEP03 EXEC PGM=IDCAMS
//*
//SYSPRINT DD SYSOUT=*
//INFILE DD DSN=IN,DISP=SHR
//OUTFILE DD DSN=OUT3,
// DISP=(NEW,CATLG,DELETE),
// DCB=(RECFM=FB,LRECL=179),SPACE=(CYL,
(20,20),RLSE),
// UNIT=SYSDA
//SYSIN DD *
REPRO INFILE(IN) -
OUTFILE(OUT3) -
SKIP(2) -
COUNT(1)
//STEP04 EXEC PGM=IDCAMS
//*
//SYSPRINT DD SYSOUT=*
//INFILE DD DSN=IN,DISP=SHR
//OUTFILE DD DSN=OUT4,
// DISP=(NEW,CATLG,DELETE),
// DCB=(RECFM=FB,LRECL=179),SPACE=(CYL,
(20,20),RLSE),
// UNIT=SYSDA
//SYSIN DD *
REPRO INFILE(IN) -
OUTFILE(OUT4) -
SKIP(3) -
COUNT(1)


LEMMI KNOW IF THIS WORKS OUT!

Is This Answer Correct ?    2 Yes 1 No

In one of intervie, my interviwer asked, I have a file which contains 4 records I would like to sp..

Answer / bramar

Hi Kiran.
Thanks for your answer can you please give a full jcl for
this senario you explained.
Thanks in advance for your answer

Is This Answer Correct ?    0 Yes 0 No

In one of intervie, my interviwer asked, I have a file which contains 4 records I would like to sp..

Answer / shridhar

//PMAP128A JOB ,'SORT SPLIT',
// MSGCLASS=Q,
// CLASS=D,TIME=0
//*
//STEP010 EXEC PGM=SORT
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=PMAP128.SORTIN,DISP=SHR
//SORTOF01 DD SYSOUT=*
//SORTOF02 DD SYSOUT=*
//SORTOF03 DD SYSOUT=*
//SORTOF04 DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
OUTFIL FILES=(01,02,03,04),SPLIT
/*
/*

Is This Answer Correct ?    1 Yes 1 No

Post New Answer

More JCL Interview Questions

If job is submitted with typerun = hold then how can we submit the same job?

3 Answers   Wipro,


What does the one advantange of using IEBUPDTE?????

2 Answers  


How jcl is used for testing batch programs?

0 Answers  


How dummy is used in jcl?

0 Answers  


Suppose a proc step has a DD statement like //ABC DD DSN=TEST.FILE1,DISP=SHR DSN=TEST.FILE2,DISP=SHR and the above DD name is overridden from the JCL as given below //procstepname.ABC DD DSN=TEST.FILE3 - Will the DD statement now have just TEST.FILE3 or it will be TEST.FILE3 and TEST.FILE2? Suppose if it is overridden twice like //procstepname.ABC DD DSN=TEST.FILE3 //procstepname.ABC DD DSN=TEST.FILE4 Will this give a JCL error? If not, what will be final output?

2 Answers  






List the various advantages of using jcl language?

0 Answers  


Explain about Specifying compiler options in the PROCESS (CBL) statement

1 Answers  


Hi, My dataset have multiple records, say 100. I want to start copy records only after a record contain a specific value that may be in a specific position. Secondly I want to stop copying rest records if certain record contains a specific value. Can it be done using SORT/ICETOOL utilities?

5 Answers   Patni,


What is catelog procedure and how many catelog procedure to use in one job?

2 Answers   Infosys,


What is the difference between the JOBLIB and the STEPLIB statements?

3 Answers  


Hi, If a catolog proc has another proc in it, both have ddnames dd1 and dd2. what proc will override if gave override parameter. Here both have same step names.

2 Answers   UHG,


What is the difference between joblib and jcllib statements

7 Answers   IBM, Maples,


Categories