Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Here's a DFSORT/ICETOOL job that will do what you asked for. I assumed your input files have RECFM=FB and LRECL=80, but the job can be changed appropriately for other attributes. I also assumed that you wanted the output records in the same order as the input records as shown in your example - that requires an extra pass.
Code: |
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD * input file1 (FB/80)
P000001XXXX
P000002XXXX
P000001YYYY
P000002YYYY
P000003YYYY
P000001ZZZZ
P000002ZZZZ
P000001AAAA
/*
//IN2 DD * input file2 (FB/80)
XXXX
YYYY
AAAA
QQQQ
/*
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//T2 DD DSN=&&T2,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT DD DSN=... output file (FB/80)
//TOOLIN DD *
COPY FROM(IN2) TO(T1) USING(CTL1)
COPY FROM(IN1) TO(T1) USING(CTL2)
SPLICE FROM(T1) TO(T2) ON(8,4,CH) -
WITHALL WITH(1,81) WITH(89,8) USING(CTL3)
SORT FROM(T2) TO(OUT) USING(CTL4)
/*
//CTL1CNTL DD *
INREC BUILD=(8:1,4,81:C'BB',89:8X)
/*
//CTL2CNTL DD *
INREC OVERLAY=(81:C'VV',89:SEQNUM,8,ZD)
/*
//CTL3CNTL DD *
OUTFIL FNAMES=T2,INCLUDE=(81,2,CH,EQ,C'VB')
/*
//CTL4CNTL DD *
SORT FIELDS=(89,8,ZD,A)
OUTREC BUILD=(1,80)
/*
|
|
|