May I please ask if it's possible to do the following using DFSORT/ICETOOL - I've tried for hours now but didn't get a solution till now.
We have the output records from a JES2 started task (i.e. a DB2 subsystem). It contains the messages that the subsystem wanted to write to the JES job log. Such messages can be one line messages, or they can be split into multiple records, by this adding a sequence number as the last word in a record, and the same sequence number as the first word in the continued record. This is how it might look like:
****** ***************************** Top of Data ******************************
=COLS> ----+----1----+----2----+----3----+----4----+----5----+----6----+----7
000001 1 J E S 2 J O B L O G -- S Y S T E M T X A 1
000002 0
000003 05.13.42 S0000120 ---- WEDNESDAY, 29 SEP 2010 ----
000004 05.13.42 S0000120 IEF695I START DSN1MSTR WITH JOBNAME DSN1MSTR
000005 05.13.50 S0000120 S DSN1DBM1
000006 05.46.06 S0000120 DSNT501I +DSN1 DSNB1LDA RESOURCE UNAVAILABLE 235
000007 235 CORRELATION-ID=010.TLPLKNC3
000008 235 CONNECTION-ID=DSN1
000009 235 LUW-ID=*
000010 235 REASON 00C200EA
000011 235 TYPE 00000200
000012 235 NAME A125XMDE.TDTCOD2
000013 18.03.57 S0000120 DSNT500I +DSN1 DSNXIDPM RESOURCE UNAVAILABLE 004
000014 004 REASON 00E70010
000015 004 TYPE 00000801
000016 004 NAME SAPCL.DB2CLDB.18D0E54106A5C1DF
000017 00.00.00 S0000120 ---- THURSDAY, 30 SEP 2010 ----
000018 05.05.22 S0000120 DSNJ138I +DSN1 DSNJOFF1 OFFLOAD COMPLETE FOR 182
000019 182 LOG TRUNCATION FROM AN ARCHIVE LOG COMMAND
000020 05.05.22 S0000120 DSNJ139I +DSN1 LOG OFFLOAD TASK ENDED
000021 05.14.01 S0082560 DSNL512I +DSN1 DSNLILNR TCP/IP 977
000022 977 GETHOSTBYADDR(nn.nn.nn.nn7) FAILED WITH
000023 977 RETURN CODE=1 AND REASONCODE=00000000
000024 23.14.01 S0082560 DSNL004I +ED01 DDF START COMPLETE
****** **************************** Bottom of Data ****************************
=COLS> ----+----1----+----2----+----3----+----4----+----5----+----6----+----7
000001 1 J E S 2 J O B L O G -- S Y S T E M T X A 1
000002 0
000003 05.13.42 S0000120 ---- WEDNESDAY, 29 SEP 2010 ----
000004 05.13.42 S0000120 IEF695I START DSN1MSTR WITH JOBNAME DSN1MSTR
000005 05.13.50 S0000120 S DSN1DBM1
000006 05.46.06 S0000120 DSNT501I +DSN1 DSNB1LDA RESOURCE UNAVAILABLE 235
000007 235 CORRELATION-ID=010.TLPLKNC3
000008 235 CONNECTION-ID=DSN1
000009 235 LUW-ID=*
000010 235 REASON 00C200EA
000011 235 TYPE 00000200
000012 235 NAME A125XMDE.TDTCOD2
000013 18.03.57 S0000120 DSNT500I +DSN1 DSNXIDPM RESOURCE UNAVAILABLE 004
000014 004 REASON 00E70010
000015 004 TYPE 00000801
000016 004 NAME SAPCL.DB2CLDB.18D0E54106A5C1DF
000017 00.00.00 S0000120 ---- THURSDAY, 30 SEP 2010 ----
000018 05.05.22 S0000120 DSNJ138I +DSN1 DSNJOFF1 OFFLOAD COMPLETE FOR 182
000019 182 LOG TRUNCATION FROM AN ARCHIVE LOG COMMAND
000020 05.05.22 S0000120 DSNJ139I +DSN1 LOG OFFLOAD TASK ENDED
000021 05.14.01 S0082560 DSNL512I +DSN1 DSNLILNR TCP/IP 977
000022 977 GETHOSTBYADDR(nn.nn.nn.nn7) FAILED WITH
000023 977 RETURN CODE=1 AND REASONCODE=00000000
000024 23.14.01 S0082560 DSNL004I +ED01 DDF START COMPLETE
****** **************************** Bottom of Data ****************************
What I do need is the following:
- Search that message file for a specific string, e.g. the string 'REASON'. (in the sample above, you'll find it on lines 10, 14, and 23).
- If that string has been found, extract the entire message.
- If the message has continuation indicators (these three digit numbers), remove the numbers from the end of the first message and all continuation records and combine all these parts to one message line.
- Remove all but one space between all words of a resulting message line
- The dataset can contain messages for more than one weekday (see lines 3 and 17). These dates should be included in the output.
29 SEP 2010 18.03.57 S0000120 DSNT500I +DSN1 DSNXIDPM RESOURCE UNAVAILABLE REASON 00E70010 TYPE 00000801 NAME SAPCL.DB2CLDB.18D0E54106A5C1DF
30 SEP 2010 05.14.01 S0082560 DSNL512I +DSN1 DSNLILNR TCP/IP GETHOSTBYADDR(nn.nn.nn.nn) FAILED WITH RETURN CODE=1 AND REASONCODE=00000000
Known specs:
- Date messages can be identified by four dashes in record position 20, the date without leading weekday starts at pos 36.
- A message starts with a time (hours) in pos 2-3 and may or may not have a continuation indication (digits)
- A continued message shows two spaces in record pos 2-3, and then 3 digits
- Input dataset is RECFM=VBA, LRECL=134, the max output record length should be (truncated to) 32760.
Some more background: Actually, I do have a REXX program doing exactly what I want. We do have an ISPF application where users can select various input file(s) and specify a search term (e.g. REASON). These files are then read one by one, and messages are massaged to long single line messages. All the resulting messages from all selected input files are then combined into one output dataset and made available for ISPF browse.
However, I have the problem that we get these 'machine storage exhausted' messages when processing large input datasets. To find a solution, I thought of SORT to exclude messages that are not relevant, and this is where my current odyssee started. When I recognized all these capabilities of sort, I've started reading tons of paperwork and tried and tried..., but none of my attempts has given me a solution and I'm completely lost now.
I know that my question is not simple - more like writing a application - but some of you specialists might want to give me a hint, or two...?
Thanks in advance!
Alex