Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
First of all, subhasis's version of the job is not the best way to do it. It's overcomplicated. Here's a better version:
Code: |
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD *
56789
BBBBB
CCCCC
/*
//IN2 DD *
11111
22222
33333
/*
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD SYSOUT=*
//TOOLIN DD *
COPY FROM(IN1) TO(T1) USING(CTL1)
COPY FROM(IN2) TO(T1) USING(CTL2)
SPLICE FROM(T1) TO(OUT) ON(81,8,ZD) WITH(6,5) USING(CTL3)
//CTL1CNTL DD *
INREC OVERLAY=(81:SEQNUM,8,ZD)
//CTL2CNTL DD *
INREC BUILD=(6:1,5,81:SEQNUM,8,ZD)
/*
//CTL3CNTL DD *
OUTFIL FNAMES=OUT,BUILD=(1,80)
/*
|
The CTL1CNTL INREC statement adds a sequence number to each IN1 record in positions 81-88.
The CNTL2CNTL INREC statement puts IN2 positions 1-5 at output positions 6-10 and adds a sequence number in positions 81-88.
Here's what the T1 records look like after the two COPY operators are used:
Code: |
56789 ... 00000001
BBBBB ... 00000002
CCCCC ... 00000003
11111 ... 00000001
22222 ... 00000002
33333 ... 00000003
|
New the SPLICE operator creates a spliced record for each pair of sequence numbers with the 1-5 field from the first record and the 6-10 field from the second record. The OUTFIL statement removes the sequence number. |
|