This example shows how you can use the KEEPNODUPS operand to tell
ICETOOL to compare the ON fields in a list of needed parts to the
ON fields in a list of on-hand parts, and produce a report showing
if each needed part is on-hand or not.
//S8 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//ONHAND DD *
P62 Blue
P62 Red
G73 Blue
A27 Green
L90 Red
P63 Blue
/*
//NEEDED DD *
2003/05/07 A27 Green
2002/12/29 P62 Blue
2003/03/17 A27 Blue
2003/06/14 M92 Yellow
2002/12/18 L90 Red
/*
//COMBINED DD DSN=&&T1,UNIT=SYSDA,SPACE=(TRK,(5,5)),
// DISP=(MOD,PASS)
//RPT DD SYSOUT=*
//TOOLIN DD *
* Reformat the ONHAND records for splicing.
* Add 'Yes' for found in ONHAND data set.
* Add 'O' to indicate ONHAND record.
COPY FROM(ONHAND) TO(COMBINED) USING(CTL1)
* Reformat the NEEDED records for splicing.
* Add 'No' for missing from ONHAND data set.
* Add 'N' to indicate NEEDED record.
COPY FROM(NEEDED) TO(COMBINED) USING(CTL2)
* Splice ONHAND and NEEDED records (splice identifier):
* NEEDED records found in ONHAND list will have 'Yes'
* and 'N'.
* NEEDED records not found in ONHAND list will have 'No'
* and 'N'.
* ONHAND records that are not needed will have 'Yes'
* and 'O'.
* Eliminate records with 'O'.
SPLICE FROM(COMBINED) TO(RPT) -
ON(1,12,CH) WITH(24,10) WITH(40,1) -
KEEPNODUPS -
USING(CTL3)
/*
//CTL1CNTL DD *
* Reformat ONHAND records with part in 1-12, 'Yes' in 15-17
* and 'O' in 40.
OUTREC FIELDS=(1:1,12,15:C'Yes',40:C'O')
/*
//CTL2CNTL DD *
* Reformat NEEDED records with part in 1-12, 'No ' in 15-17,
* date in 24-33 and 'N' in 40.
OUTREC FIELDS=(1:15,12,15:C'No',24:2,10,40:C'N')
/*
//CTL3CNTL DD *
* Eliminate ONHAND parts that do not appear in NEEDED list.
* Create the report showing if needed parts are on-hand.
OUTFIL FNAMES=RPT,OMIT=(40,1,CH,EQ,C'O'),OUTREC=(1,33),
HEADER2=(1:'Part',15:'On-Hand',24:'Needed by',/,
1:'------------',15:'-------',24:'----------')
/*
The base records originate from the ONHAND data set and are copied
and reformatted to the COMBINED data set. We put an 'O' in position
40 to identify these records as ONHAND records. The overlay records
originate from the NEEDED data set and are copied and reformatted
to the COMBINED data set. We put an 'N' in position 40 to identify
these records as NEEDED records. Because MOD is used for the COMBINED
data set, it contains the reformatted ONHAND records followed by the
reformatted NEEDED records. The COMBINED records are 40 bytes long
and look like this:
P62 Blue Yes O
P62 Red Yes O
G73 Blue Yes O
A27 Green Yes O
L90 Red Yes O
P63 Blue Yes O
A27 Green No 2003/05/07 N
P62 Blue No 2002/12/29 N
A27 Blue No 2003/03/17 N
M92 Yellow No 2003/06/14 N
L90 Red No 2002/12/18 N
The base and overlay records from the COMBINED data set are sorted
and spliced.
The records look like this
after they are
sorted on the 1,12,CH field, but
before they
are spliced. As a visual aid, the WITH fields in the overlay records
are shown in bold.
A27 Blue No 2003/03/17 N
A27 Green Yes O
A27 Green No 2003/05/07 N
G73 Blue Yes O
L90 Red Yes O
L90 Red No 2002/12/18 N
M92 Yellow No 2003/06/14 N
P62 Blue Yes O
P62 Blue No 2002/12/29 N
P62 Red Yes O
P63 Blue Yes O
The spliced output records are 40 bytes long and look like this:
A27 Blue No 2003/03/17 N
A27 Green Yes 2003/05/07 N
G73 Blue Yes O
L90 Red Yes 2002/12/18 N
M92 Yellow No 2003/06/14 N
P62 Blue Yes 2002/12/29 N
P62 Red Yes O
P63 Blue Yes O
We have three types of records as follows:
- Records with 'Yes and 'N' are NEEDED records with an ONHAND match
that have been spliced together. We want these for our report.
- Records with 'No' and 'N' are NEEDED records without an ONHAND
match that have been kept because we used KEEPNODUPS. We want these
for our report.
- Records with 'Yes' and 'O' are ONHAND records without a NEEDED
match that have been kept because we used KEEPNODUPS. We do not want
these for our report.
We use the OUTFIL statement for SPLICE to further process the spliced
records. It omits the 'O' records, removes the 'N' byte, and sets
up the headers for the report. The resulting RPT data set looks like
this:
Part On-Hand Needed by
------------ ------- ----------
A27 Blue No 2003/03/17
A27 Green Yes 2003/05/07
L90 Red Yes 2002/12/18
M92 Yellow No 2003/06/14
P62 Blue Yes 2002/12/29