Re: Variable Sort Parsing
Kolusu, this worked great! I went with the Version 2 selection, and replaced the pipe delimiter with just a simple space. Thanks again - one day, I hope to be able to do these simple things myself! Thank you and best regards, Billy Ashton -- Original Message -- From "Sri h Kolusu" To IBM-MAIN@listserv.ua.edu Date 10/20/2022 12:15:22 AM Subject Re: Variable Sort Parsing 2. The input is a FB file of 150, and these records are just space padded. The other log records in the file are of all different lengths, with some using the whole 150. Billy, It is quite simple to parse out the contents. I am going to 2 show different versions. Version 1 : will Parse ALL fields and then we pick and choose which fields we need Version 2 : Will Parse ONLY specific fields of interest. FIXLEN is the parm which determines the length of the parsed field, so adjust it according to your needs. I added a Delimiter of '|' to distinguish the fields. You can remove it if you don't need it Version 1 : //STEP0100 EXEC PGM=SORT //SYSOUT DD SYSOUT=* //SORTIN DD DISP=SHR,DSN=your Input FB 150 byte file //SORTOUT DD SYSOUT=* //SYSINDD * OPTION COPY INCLUDE COND=(001,150,SS,EQ,C'MSG004CI') INREC IFTHEN=(WHEN=INIT, BUILD=(001,150,SQZ=(SHIFT=LEFT,MID=C' '))), IFTHEN=(WHEN=INIT, PARSE=(%01=(ENDBEFR=BLANKS,FIXLEN=08), # Job Time %02=(ENDBEFR=BLANKS,FIXLEN=08), # Job num %03=(ENDBEFR=BLANKS,FIXLEN=08), # Job name %04=(ENDBEFR=BLANKS,FIXLEN=08), # Msg number %05=(STARTAFT=C'PARM ', ENDBEFR=C': ',FIXLEN=15), # Prog parm %06=(ENDBEFR=C',',FIXLEN=08),# Job Date %07=(STARTAFT=C'(', ENDBEFR=C') ',FIXLEN=10), # Run Type %08=(ENDBEFR=BLANKS,FIXLEN=15), # Location %09=(ENDBEFR=BLANKS,FIXLEN=06)), # Indicator BUILD=(%03, # Job name C'|',# Delimiter %05, # Prog Parm C'|',# Delimiter %06, # Job Date C'|',# Delimiter %07, # Run Type C'|',# Delimiter %08, # Location C'|',# Delimiter %09, # Indicator C'|')) # Delimiter /* The output from this is PAYW015A|SCHEDULED |20221008|WEEKLY|ALLSITES |10.4 | PAYW052X|REQUEST|20221012|DAILY |OH03 |10.6 | BILLW015|new|20221016|hourly|ASH01 |10.2 | Version 2: Notice the ignored fields with % and pay attention to FIXLEN parm //SYSINDD * OPTION COPY INCLUDE COND=(001,150,SS,EQ,C'MSG004CI') INREC IFTHEN=(WHEN=INIT, BUILD=(001,150,SQZ=(SHIFT=LEFT,MID=C' '))), IFTHEN=(WHEN=INIT, PARSE=(%=(ENDBEFR=BLANKS), # Job Time %=(ENDBEFR=BLANKS), # Job num %03=(ENDBEFR=BLANKS,FIXLEN=08), # Job name %=(ENDBEFR=BLANKS), # Msg number %05=(STARTAFT=C'PARM ', ENDBEFR=C': ',FIXLEN=03), # Prog parm %06=(ENDBEFR=C',',FIXLEN=08),# Job Date %07=(STARTAFT=C'(', ENDBEFR=C') ',FIXLEN=01), # Run Type %08=(ENDBEFR=BLANKS,FIXLEN=15), # Location %09=(ENDBEFR=BLANKS,FIXLEN=06)), # Indicator BUILD=(%03, # Job name C'|',# Delimiter %05, # Prog Parm C'|',# Delimiter %06, # Job Date C'|',# Delimiter %07, # Run Type C'|',# Delimiter %08, # Location C'|',# Delimiter %09, # Indicator C'|')) # Delimiter /* The output from this is PAYW015A|SCH|20221008|W|ALLSITES |10.4 | PAYW052X|REQ|20221012|D|OH03 |10.6 | BILLW015|new|20221016|h|ASH01 |10.2 | Thanks, Kolusu DFSORT Development IBM Corporation -- For IBM-MAIN subscribe / signoff / archive access in
Re: Variable Sort Parsing
>>2. The input is a FB file of 150, and these records are just space padded. >>The other log records in the file are of all different lengths, with some >>using the whole 150. Billy, It is quite simple to parse out the contents. I am going to 2 show different versions. Version 1 : will Parse ALL fields and then we pick and choose which fields we need Version 2 : Will Parse ONLY specific fields of interest. FIXLEN is the parm which determines the length of the parsed field, so adjust it according to your needs. I added a Delimiter of '|' to distinguish the fields. You can remove it if you don't need it Version 1 : //STEP0100 EXEC PGM=SORT //SYSOUT DD SYSOUT=* //SORTIN DD DISP=SHR,DSN=your Input FB 150 byte file //SORTOUT DD SYSOUT=* //SYSINDD * OPTION COPY INCLUDE COND=(001,150,SS,EQ,C'MSG004CI') INREC IFTHEN=(WHEN=INIT, BUILD=(001,150,SQZ=(SHIFT=LEFT,MID=C' '))), IFTHEN=(WHEN=INIT, PARSE=(%01=(ENDBEFR=BLANKS,FIXLEN=08), # Job Time %02=(ENDBEFR=BLANKS,FIXLEN=08), # Job num %03=(ENDBEFR=BLANKS,FIXLEN=08), # Job name %04=(ENDBEFR=BLANKS,FIXLEN=08), # Msg number %05=(STARTAFT=C'PARM ', ENDBEFR=C': ',FIXLEN=15), # Prog parm %06=(ENDBEFR=C',',FIXLEN=08),# Job Date %07=(STARTAFT=C'(', ENDBEFR=C') ',FIXLEN=10), # Run Type %08=(ENDBEFR=BLANKS,FIXLEN=15), # Location %09=(ENDBEFR=BLANKS,FIXLEN=06)), # Indicator BUILD=(%03, # Job name C'|',# Delimiter %05, # Prog Parm C'|',# Delimiter %06, # Job Date C'|',# Delimiter %07, # Run Type C'|',# Delimiter %08, # Location C'|',# Delimiter %09, # Indicator C'|')) # Delimiter /* The output from this is PAYW015A|SCHEDULED |20221008|WEEKLY|ALLSITES |10.4 | PAYW052X|REQUEST|20221012|DAILY |OH03 |10.6 | BILLW015|new|20221016|hourly|ASH01 |10.2 | Version 2: Notice the ignored fields with % and pay attention to FIXLEN parm //SYSINDD * OPTION COPY INCLUDE COND=(001,150,SS,EQ,C'MSG004CI') INREC IFTHEN=(WHEN=INIT, BUILD=(001,150,SQZ=(SHIFT=LEFT,MID=C' '))), IFTHEN=(WHEN=INIT, PARSE=(%=(ENDBEFR=BLANKS), # Job Time %=(ENDBEFR=BLANKS), # Job num %03=(ENDBEFR=BLANKS,FIXLEN=08), # Job name %=(ENDBEFR=BLANKS), # Msg number %05=(STARTAFT=C'PARM ', ENDBEFR=C': ',FIXLEN=03), # Prog parm %06=(ENDBEFR=C',',FIXLEN=08),# Job Date %07=(STARTAFT=C'(', ENDBEFR=C') ',FIXLEN=01), # Run Type %08=(ENDBEFR=BLANKS,FIXLEN=15), # Location %09=(ENDBEFR=BLANKS,FIXLEN=06)), # Indicator BUILD=(%03, # Job name C'|',# Delimiter %05, # Prog Parm C'|',# Delimiter %06, # Job Date C'|',# Delimiter %07, # Run Type C'|',# Delimiter %08, # Location C'|',# Delimiter %09, # Indicator C'|')) # Delimiter /* The output from this is PAYW015A|SCH|20221008|W|ALLSITES |10.4 | PAYW052X|REQ|20221012|D|OH03 |10.6 | BILLW015|new|20221016|h|ASH01 |10.2 | Thanks, Kolusu DFSORT Development IBM Corporation -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: Variable Sort Parsing
Hi Kolusu, and thanks for looking into this. 1. No, these are two different records, with different parameters on them. They are both MSG004CI, but have different data fields. I tried to show just two with the shortest and the longest length. Each message is one line with: time Jobnum jobname Msgkey - "Program Parm" type date , runtype() location numeric-code 2. The input is a FB file of 150, and these records are just space padded. The other log records in the file are of all different lengths, with some using the whole 150. Thank you and best regards, Billy Ashton -- Original Message -- From "Sri h Kolusu" To IBM-MAIN@listserv.ua.edu Date 10/19/2022 8:57:22 PM Subject Re: Variable Sort Parsing This will be fed into another reporting program to generate different reports, along with other operational data. Here are the two basic kinds of formats: 01.34.15 JOB47986 PAYW015A MSG004CI - PROGRAM PARM SCHEDULED: 20221008, RUNTYPE(WEEKLY) ALLSITES 10.4 >> 01.34.15 JOB47986 PAYW052X MSG004CI - PROGRAM PARM REQUEST: 20221012, RUNTYPE(DAILY) OH03 10.6 Hi Billy, You have the right idea of using PARSE in DFSORT to extract the data. However, I need a few more details. 1. The sample input that you have shown for EACH MSG004CI is split into 2 records. Is that right ? If so, can there be a single line message for MSG004CI ? 2. What is the LRECL and RECFM of the input file? Thanks, Kolusu DFSORT Development IBM Corporation -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: Variable Sort Parsing
>> This will be fed into another reporting program to generate different >> reports, along with other operational data. Here are the two basic kinds of >> formats: >> 01.34.15 JOB47986 PAYW015A MSG004CI - PROGRAM PARM SCHEDULED: >> 20221008, RUNTYPE(WEEKLY) ALLSITES 10.4 >> 01.34.15 JOB47986 PAYW052X MSG004CI - PROGRAM PARM REQUEST: 20221012, >>RUNTYPE(DAILY) OH03 10.6 Hi Billy, You have the right idea of using PARSE in DFSORT to extract the data. However, I need a few more details. 1. The sample input that you have shown for EACH MSG004CI is split into 2 records. Is that right ? If so, can there be a single line message for MSG004CI ? 2. What is the LRECL and RECFM of the input file? Thanks, Kolusu DFSORT Development IBM Corporation -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Variable Sort Parsing
Hi all, I have a SORT problem I can't quite get my head around. I think I want to use PARSE, but can't figure out if there is an easy way to do it. I have an application log file that contains joblogs of thousands of jobs a day, all with different records. I am interested in only getting records with a key value of MSG004CI . However, the records have variable format, and I would like to have SORT not only extract the records, but also just give me the fields I need. This will be fed into another reporting program to generate different reports, along with other operational data. Here are the two basic kinds of formats: 01.34.15 JOB47986 PAYW015A MSG004CI - PROGRAM PARM SCHEDULED: 20221008, RUNTYPE(WEEKLY) ALLSITES 10.4 01.34.15 JOB47986 PAYW052X MSG004CI - PROGRAM PARM REQUEST: 20221012, RUNTYPE(DAILY) OH03 10.6 Here are my requirements: 1. We will extract if the message is MSG004CI and then I need the jobname word that comes before that. 2. Next, I need to know how the job was run - either Scheduled or Request and the date it was run (follows the type). Output is either SCH or REQ then the date. 3. Then, I want to know what type of run. This can be Daily, Weekly, Monthly, or Yearly. Output D, W, M, or Y. 4. Next, I need to know the locations processed: This is a variable length value, ALLSITES is the longest, OH03 is the shortest, with others of other lengths between. 5. Finally, I need the numeric indicator at the end of the line. So given the above records, my output would be PAYW015A SCH 20221008 W ALLSITES 10.4 PAYW052X REQ 20221012 D OH03 10.6spaces to allow me to have a fixed format> I think I would use Parse to capture these 6 fields, but don't know how to allow for the different positions they could have. Can you help with the Inrec definition? Thank you and best regards, Billy Ashton -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN