//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file (FB/133)
//SORTOUT DD DSN=... output file (FB/133)
//SYSIN DD *
OPTION COPY
* If conditions are met, write entire record.
INREC IFTHEN=(WHEN=(18,15,SS,EQ,C' J E S 2',OR,
20,8,CH,EQ,C'IRR010I ',OR,
18,11,CH,EQ,C' ICH70001I',OR,
20,6,CH,EQ,C'$HASP3'),
BUILD=(1,133)),
* If conditions are not met, write placeholder record.
IFTHEN=(WHEN=NONE,BUILD=(C'!@#'))
I'm testing this code from Frank and it works perfectly but I'm wondering if its possible to put out the record count on every line put out and does sort know the name of the file its reading to put it out too with the record count. I know this is possible in Fileaid but can't find this in the docs yet.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Quote:
I'm wondering if its possible to put out the record count on every line put out
If by "the record count", you mean a sequence number, you can use DFSORT's SEQNUM parameter for that, e.g., SEQNUM,8,ZD
If you want more specific help you need to give the details of how you want the output records to look and exactly what you mean by "the record count". Do you want the seqnum of the original input records, or only the output records, or what? Or do you mean something different by "the record count"?
I guess what I mean is the sequence number of the original file. Like that example above. if I find the record I output it whole and if the record doesn't match I still output a marker but I want the sequence number from the original file for the whole record or the place holder. If that makes any sense.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Here's a revised DFSORT job that has the sequence number of the original input record at the end of each record:
Code:
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file (FB/133)
//SORTOUT DD DSN=... output file (FB/141)
//SYSIN DD *
OPTION COPY
* Add seqnum at end of each record.
INREC IFTHEN=(WHEN=INIT,OVERLAY=(134:SEQNUM,8,ZD)),
* If conditions are met, write entire record and seqnum.
IFTHEN=(WHEN=(18,15,SS,EQ,C' J E S 2',OR,
20,8,CH,EQ,C'IRR010I ',OR,
18,11,CH,EQ,C' ICH70001I',OR,
20,6,CH,EQ,C'$HASP3'),
BUILD=(1,133,134:134,8)),
* If conditions are not met, write placeholder record and seqnum.
IFTHEN=(WHEN=NONE,BUILD=(C'!@#',134:134,8))
/*
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file (FB/133)
//SORTOUT DD DSN=... output file (FB/141)
//SYSIN DD *
OPTION COPY
* Add seqnum at end of each record.
INREC IFTHEN=(WHEN=INIT,OVERLAY=(134:SEQNUM,8,ZD)),
* If conditions are met, write entire record and seqnum.
IFTHEN=(WHEN=(18,15,SS,EQ,C' J E S 2',OR,
20,6,CH,EQ,C'$HASP3'),
BUILD=(1,133,134:134,8))
* If conditions are not met, write placeholder record and seqnum.
* IFTHEN=(WHEN=NONE,BUILD=(C'!@#',134:134,8))
How would I modify this so that just the ones i'm searching for like JES2 or Hasp go into the output file with the sequence number for its original position in the input file. I don't want the second build. I tried to remove it but then I get all records.
I've been playing with the above code trying to put the sequence number in the first 7 bytes of the record and the rest of the record after the 7 bytes using this code... its a modification of the other you gave me.
But it keeps overlaying the first 7 bytes of the record... what am I doing wrong..
OPTION COPY
* ADD SEQUENCE NUMBER.
INREC OVERLAY=(1:SEQNUM,7,ZD)
* SELECT DESIRED RECORDS.
OUTFIL INCLUDE=(18,15,SS,EQ,C' J E S 2',OR,
15,18,CH,EQ,C'JOB EXECUTION DATE',OR,
15,18,CH,EQ,C'MINUTES EXECUTION TIME',OR,
20,05,CH,EQ,C'$HASP'),
BUILD=(1:1,125,126:126,8)