Phantom Data Mgmt Moderator
Joined: 07 Jan 2003 Posts: 1056 Topics: 91 Location: The Blue Planet
|
Posted: Fri May 08, 2009 12:41 pm Post subject: Syncsort: Trailer count validation |
|
|
This might be a regular question, but I can't think of a way to handle all scenarios in 1 step. Looking out for expert's help...
Input File: RECFM=VB,LRECL=4355
Code: |
Command ===> Scroll ===> CSR
002641 C 00010400574601AS20040505332300 0000000000001000 08
002642 C 00010400574701AS20040505332300 0000000000001000 08
002643 C 00010800225501JH20080428332200 0000000000001000 & 08
002644 C 00010800225901JH20080428332200 0000000000001000 & 08
=COLS> ----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
002645 C 9999999999CAP19990505 002643 \
|
The last record is a trailer record identified by 9999999999 in position 7 (3+RDW= 7) and Position 33 thru 37 is the count of records (excluding Header & Trailer)
I need to do the following
a. Count the number of data records and see if it matches with trailer
b. If yes then
Strip off the trailer from the input file and pass the header+data to next step
c. If NO then
1. The output file must be created "EMPTY"
2. Force return code of '4'
3. Based on the return code, the following step will send a email notification to respective group notifying them that the trailer count does not match
The output of this job is being fed to next job which concatenates multiple files. So, irrespective of the trailer count I should let the following job run. Either process one or more empty files (or) all files with data
Solution
a. I have the following sort to validate the trailer count and force RC 4 if it mismatches
b. Using COND, I send an email in the next step.
Code: |
//R010 EXEC PGM=SORT,PARM='NULLOUT=RC4'
//SORTIN DD DSN=DTF1.FFBATSPL.GENEXTFL.BLK#XXXX,
// DISP=SHR
//SORTOUT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSIN DD *
INREC FIELDS=(1,4, * RDW FOR VB FILE *
5,40, * 40 BYTES DATA CONTAINING TRL COUNT *
SEQNUM,8,ZD) * 8 DIGIT SEQUENCE NUMBER GENERATOR *
SORT FIELDS=COPY
OUTREC FIELDS=(1,44,45,8,ZD,SUB,+2,ZD,LENGTH=8)
OUTFIL INCLUDE=(7,10,ZD,EQ,9999999999,AND,
(33,6,ZD,EQ,45,8,ZD))
/*
|
Question:
1. How do I strip off the trailer record from the input for a successful processing in the same SORT step.
My Syncsort version is "SYNCSORT FOR Z/OS 1.2.3.1R "
Thanks
Phantom |
|