Multiline Message Sifting With DFSORT
MartinPacker 11000094DH Visits (7408)
Frank Yaeger of DFSORT Development suggested I pass this tip along to y'all. It's his solution to a problem set by Brian Peterson of UnitedHealth Group...
In z/OS Release 12 two new messages were introduced: IEF032I and IEF033I replace IEF374I and IEF376I. The older messages were single-line step- and job-end messages. The new ones are their multiple-line analogues: IEF032I is 3 lines and IEF033I is 2 lines.
The problem is how to sift these messages out in a program.
Here's Frank's solution:
It uses DFSORT's IFTHEN WHEN=GROUP to form groups. Overall the trick is to assign a group number to those records that are part of the message (placing it in position 134) and leave the records which aren't with a blank in position 134.
The OUTFIL statement keeps only those records without a blank in position 134, truncating the output to 133 bytes.
So, how does it distinguish between those records that are part of an IEF032I or IEF033I message? The INREC statement uses a pair of IFTHEN clauses in a short "pipeline":
Looking back I see I used the term "pipeline" for IFTHEN in Unknown Unknowns in 2006. This example incorporates a two-stage pipeline: Any records not satisfying the BEGIN= clause in <1> (the first stage) are passed to the second stage (marked <2>). But no records that satisfy the clause are passed on. (If we wanted them to we could code "HIT=NEXT" - but that wouldn't be useful here.)
The code I've shown above is just what Brian needed - and I haven't altered it from what Frank sent me.
I think there are three fairly obvious twists to this:
But Frank's example is a very good one and I'm glad he sent it to me. This is a sort of "guest post" though I did all the writing. I wonder if there are topics you would like Frank to actually "guest post" on. I can put them to him.