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

in step1 of a jcl,disp=(mod,delete,delete) step02 exec pgm=ccc,cond=(0,le) will step02 be executed? i)never ii)always iii) iv)... i dont remember options

4 Answers   HSBC,


What do you do if you do not want to keep all the space allocated to a dataset?

2 Answers  


What is the difference between BLKSIZE and LRECL?

3 Answers  


. What is the difference between the following statements : I) step#1 exec PGM=accpay ii) step#1 exec tbalance

1 Answers  


Name the parameters which can be used to limit the number of records written to a sysout dataset?

0 Answers  






I have one GDG. Everyday One new version is being created.Now I want to split this created version in different files each having 1000 records. Here Problem is I don't know How many records will be there in new version of GDG? that's why I don't know How many Out files we need to use . Interesting??????????????

4 Answers   CTS,


Hi, I have 3 files say file A , file B and file C.I want to form an output file in which i will have all the records from file A. Files B and C also may contain records that are present in file A.I want those records also to be included in my output file. for eg: file A contains: 1 2 3 file B contains: 2 4 5 file C contains: 1 3 5 So in my output file should look like: 1 2 3 2 1 3 Can any one help ???.....thanks in advance.

2 Answers  


can i sort packed decimal if i can tell the syntax

1 Answers   Barclays,


wht is sysudump n sysout,sysprint ?

1 Answers   L&T,


Can I concatenate various datasets whose organization are different from each other. Lets say I want to cancatenate a PDS file, a PS file, a GDG file etc. Can You do that ?? If yes, how ? is there any separate Utility to do so ???

4 Answers  


proc1,proc2,up to proc5 is there if i want to call proc1 and proc5how can u write the code

2 Answers  


Explain about LMINIT - generate a data ID for a data set

1 Answers  


Categories