Howard Brazee wrote on 01/29/2007 10:34:41 AM:
> Could you explain what you're doing here?
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=... input file (FB/80)
//CTL2CNTL DD DSN=&&T1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//OUT DD DSN=... output file (FB/80)
//TOOLIN DD *
COPY FROM(IN) TO(CTL2CNTL) USING(CTL1)
COPY FROM(IN) TO(OUT) USING(CTL2)
//CTL1CNTL DD *
INREC OVERLAY=(81:SEQNUM,8,ZD)
OUTFIL FNAMES=CTL2CNTL,INCLUDE=(1,2,BI,EQ,X'0000'),
BUILD=(C' OPTION COPY,STOPAFT=',81,8,80:X)
/*
The first COPY operator uses the CTL1CNTL statements against the IN data
set to create the CTL2CNTL data set.
In CTL1CNTL, the INREC OVERLAY overlays a sequence number, starting with
00000001, in positions 81-88 of every record (actually in this case we
could add the sequence number in positions 5-12 since we only care about
positions 1-2, but using 81-88 makes it more general in that all of the
positions are available for the INCLUDE condition if needed). The OUTFIL
INCLUDE finds the record with X'0000' in positions 1-2 and the OUTFIL BUILD
generates a control statement in CTL2CNTL for that record as follows:
OPTION COPY,STOPAFT=nnnnnnnn
where nnnnnnnnn is the sequence number of the record found by the INCLUDE.
So for example, if the fourth record has X'0000' in positions 1-2, CTL2CNTL
will have:
OPTION COPY,STOPAFT=00000004
The second COPY operator uses the CTL2CNTL statement against the IN data
set to create the OUT data set. CTL2CNTL has the generated OPTION
COPY,STOPAFT=nnnnnnnn statement so it will stop reading/writing records at
record nnnnnnnn (the fourth record in our previous example).
If more than one X'0000' record is present, we'll generate more than one
OPTION statement, but only the first one will be used and the others will
be ignored, e.g.
OPTION COPY,STOPAFT=00000004
OPTION COPY,STOPAFT=00000012
DFSORT will use the first statement and stop at record 4. DFSORT will flag
the second statement as a duplicate and ignore it (RC=0).
Frank Yaeger - DFSORT Team (IBM) - [EMAIL PROTECTED]
Specialties: PARSE, JFY, SQZ, ICETOOL, IFTHEN, OVERLAY, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort/
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html