1) Input file one : Consists of 50 rows with records length 9.
2) Input file two: Consists of 100 rows with records length 3.
Problem : I have to take one record every time from input file 2 and paste it in the position 4 to 6 in all the rows of input file 1 which means there will be 5000 records in the output file.
file 1:
aaabbbccc
dddeeefff
ggghhhiii
file 2:
111
222
333
Desired Output file :
aaa111ccc
ddd111fff
ggg111iii
aaa222ccc
ddd222fff
ggg222iii
aaa333ccc
ddd333fff
ggg333iii
The JCL which I have written is allowing only the first record number provided in the SYSIN DD statement. I am just getting the output as :
aaa111ccc
ddd111fff
ggg111iii
I have used the above example just for explanation purpose, the real JCL looks like below:
//STEP010 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
//SORTOUT DD DSN=**.****.OUTPUT1,
// DISP=(NEW,CATLG,DELETE),SPACE=(CYL,(5,5),RLSE)
//SYSIN DD *
SORT FIELDS=COPY
OUTREC FIELDS=(1,9,50:SEQNUM,5,ZD,START=00001,INCR=1)
/*
//STEP020 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
111
222
333
//*SORTOUT DD SYSOUT=*
//SORTOUT DD DSN=**.****.OUTPUT2,
// DISP=(NEW,CATLG,DELETE),SPACE=(CYL,(5,5),RLSE)
//SYSIN DD *
OPTION COPY
OUTFIL REPEAT=3,OVERLAY=(50:SEQNUM,5,ZD)
/*
//STEP030 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTJNF1 DD DISP=SHR,DSN=**.****.OUTPUT1
//SORTJNF2 DD DISP=SHR,DSN=**.****.OUTPUT2
//SORTOUT DD DSN=**.****.OUTPUT3,DISP=(NEW,CATLG,DELETE),
// SPACE=(CYL,(10,10),RLSE)
//SYSIN DD *
JOINKEYS F1=SORTJNF1,FIELDS=(50,5,A),SORTED
JOINKEYS F2=SORTJNF2,FIELDS=(50,5,A),SORTED
REFORMAT FIELDS=(F1:1,3,F2:1,3,F1:7,9)
SORT FIELDS=COPY
/*
//SYSOUT DD SYSOUT=*
//SORTIN DD *
//SORTOUT DD DSN=**.****.OUTPUT1,
// DISP=(NEW,CATLG,DELETE),SPACE=(CYL,(5,5),RLSE)
//SYSIN DD *
SORT FIELDS=COPY
OUTREC FIELDS=(1,9,50:SEQNUM,5,ZD,START=00001,INCR=1)
/*
//STEP020 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
111
222
333
//*SORTOUT DD SYSOUT=*
//SORTOUT DD DSN=**.****.OUTPUT2,
// DISP=(NEW,CATLG,DELETE),SPACE=(CYL,(5,5),RLSE)
//SYSIN DD *
OPTION COPY
OUTFIL REPEAT=3,OVERLAY=(50:SEQNUM,5,ZD)
/*
//STEP030 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTJNF1 DD DISP=SHR,DSN=**.****.OUTPUT1
//SORTJNF2 DD DISP=SHR,DSN=**.****.OUTPUT2
//SORTOUT DD DSN=**.****.OUTPUT3,DISP=(NEW,CATLG,DELETE),
// SPACE=(CYL,(10,10),RLSE)
//SYSIN DD *
JOINKEYS F1=SORTJNF1,FIELDS=(50,5,A),SORTED
JOINKEYS F2=SORTJNF2,FIELDS=(50,5,A),SORTED
REFORMAT FIELDS=(F1:1,3,F2:1,3,F1:7,9)
SORT FIELDS=COPY
/*
Please tell me how should I proceed with this. I want to know of something which picks one record from the second input file and executes the job. After that, again it picks the second record and executes it. I am also open to any new methods of achieving this.