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

Explain about Internal Sort

1 Answers  


Can we have a JOBSTEP without any EXEC ?

6 Answers   IBM,


I have a JCL which 20 steps. How do I execute 17 th step alone (It should execute only 17ths tep.and it should not execute 18,19,20 steps??

9 Answers   IBM, Infosys, TCS, Xansa, Xchanging,


What do you know about jcl?

0 Answers  


i want to restart frm step 2, previously i coded cond parameter on step2 wht happens at tht time ?

4 Answers   Infosys,






What is the difference between primary and secondary allocations for a dataset?

8 Answers  


hi in one of the interview one asked me how to submit a job from cobol?as well as how to submit a jcl from CICS? can u pls any one tell me..

1 Answers   CTS,


I have four steps in jcl they are STEP1,STEP2,STEP3 and STEP4. Can it possible to run the reverse order like step4 first then step3,step2,step1?

4 Answers   Broadridge, HCL,


How to check empty file in jcl?

4 Answers   Infosys,


Hello Guys, I have 1+ Year Experience in MAINFRAME TESTING. After 1 Week I have an Interview With a Company on Mainframe Testing. Please Could You Guys Please Suggest me What Sections Should I prepare ?? ___Tell Me the Topic Or Appropriate Site & Links. ?? ---------------Thank You

0 Answers   IBM,


Is there GOTO and SWITCH-CASE available in JCL ? Is IF-THEN-ELSE available in JCL also just like it is available for VSAM datasets under Model Commands category ?

1 Answers   IBM,


A job has 150 steps i want to execute only 57th step

3 Answers   Cognizant,


Categories