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?
Answer Posted / muttiah
I'm not sure about the answers posted.But you can try this
simple JCL to achieve what you want.
//JOBCARD /*As per your company standard*/
//STEP1 EXEC PGM=SORT
//Sortin DD DSN=<Inputfile>,disp=shr
//SORT0F01 DD DSN=<FILENM1>,DISP=OLD
//SORT0F02 DD DSN=<FILENM2>,DISP=OLD
//SORT0F03 DD DSN=<FILENM3>,DISP=OLD
//SORT0F04 DD DSN=<FILENM4>,DISP=OLD
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY OR SORT FIELDS=COPY
OUTFIL FILES=01,STARTREC=1,ENDREC=1
OUTFIL FILES=02,STARTREC=2,ENDREC=2
OUTFIL FILES=03,STARTREC=3,ENDREC=3
OUTFIL FILES=04,STARTREC=4,ENDREC=4
/*
//
NOTE: I have given DISP=OLD which means it will override
the contents when you submit the jcl
If you want to create a new dataset replace like this
EX:
//SORT0F04 DD DSN=<FILENM4>,DISP=(NEW,CATLG,DELETE),
// SPACE=(TRK,(1,4)),DCB=*.SORTIN
Hope this makes sense!!
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
I have a COBOL program that ACCEPTs some input data. How do you code the JCL statement for this?
What is 'mounting' of volumes ? Is there anything that a programmer can do in it ? How to find currently mounted volume ?
which parameter is used to check the syntax of a jcl without executing it?
Why include statement is used in a jcl?
I want to JCL sort for Non-COMP and COMP-3 fields SORT FIELDS=(1,5,A,6,11,A,12,11,A,19,1,A,20,1,A),FORMAT=BI,EQUALS Length of comp bytes is 11 bytes which start at 6byte and 12 byte considering 11 bytes in comp-3 is 6 bytes. Can anyone tell if the above sort work SORT FIELDS=(1,5,A,6,6,A,12,6,A,19,1,A,20,1,A),FORMAT=BI,EQUALS does not works OK
Why block size is multiple of lrecl in jcl?
Explain dd statement in jcl?
How does jcl specify the job to the operating system?
Are there any set of rules for the names of the steps used in a job? What are they?
How jcl work to handle various input output file operations?
how do you create a dataset in a jcl with the same file organisation as that of another existing dataset?
Can an individual step be restricted from using all the jobs allowed cpu time?
when can a job time-out occur? How to overcome that?
What parameter of the job statement is used to limit the cpu time consumed by the job?
What is the function of the dd avgrec keyword in sms datasets?