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

What is DATACOM db?

2 Answers  


i have 3 steps in my jcl, where i want to run only one step at a time depending on the variable. How should i give the condition statement... I have tried this with two steps which is working but not able to add condn for the 3rd step. can anyone help me... I want to know the cond stmt which i can code in step 3 and step4, so that only either step2 or step3 or step4 executes

3 Answers  


What happens if both JOBLIB & STEPLIB is specified ?

0 Answers  


I HAVE A VB BLOCK WHICH IS USED AS INPUT IN COBOL CONATINING SOME RECORDS CAN I CHANGE THE FILE FROM VB TO FB?

0 Answers  


How do you submit a job for execution?

0 Answers  






GDG Create syntax ?

4 Answers   Xansa,


The disp in the JCL is MOD and the program opens the file in OUTPUT mode. What happens ? The DISP in the JCL is SHR and the program opens the file in EXTEND mode. What happens ?

3 Answers  


How many types of parameters are used in JCL and what are mandatory parameters of JOB statement.

13 Answers   IBM,


Suppose I have a file with three fields with data in the following format 1. empid - S9(4) COMP 2. empname - X(20) 3. empsal - S9(5)V(2) COMP-3 If I view this file, it will not be in a readable format. How to display the empid and empsal fields in a readable format without using COBOL program? What kind of SORT card will have to be coded?

4 Answers  


What are three major types of JCL statements? What are their functions?

1 Answers  


What statement marks the beginning of a job step; assigns a name to the step; identifies the program or catalogued or in-stream procedure to be executed in the step?

0 Answers  


In job processing, what happens in execution stage?

0 Answers  


Categories