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" <[email protected]>
To [email protected]
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=*
//SYSIN    DD *
 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

//SYSIN    DD *
 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 [email protected] with the message: INFO IBM-MAIN

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to