MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

DFSort/ICETOOL PARSE on optional fields in variable position

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
peterwarren
Beginner


Joined: 12 Jul 2018
Posts: 2
Topics: 2

PostPosted: Fri Nov 01, 2024 6:56 am    Post subject: DFSort/ICETOOL PARSE on optional fields in variable position Reply with quote

Hi, I have the following code and data that I am trying to extract 3 fields that may/may not be there and are not in fixed positions: Looking on the internet there are many forums saying to use the IFTHEN(WHEN=INIT command but it doesn't work for me - it finds the first field but no more after that - any ideas please.
JCL:
Code:

//STEP010  EXEC PGM=ICEMAN                                     
//SORTIN   DD DISP=SHR,DSN=TTFO.PQUQ.NPDARCH.PRPY.D24032.V2     
//SORTOUT  DD  DSN=TTFO.WARREPB.PPAY.ARCH.FUND.Y2024.QMU.&MTH, 
//             DISP=(NEW,CATLG),UNIT=DASD,SPACE=(TRK,(600,     
//             150),RLSE),RECFM=VB,LRECL=400                   
//SYSOUT   DD  SYSOUT=*                                         
//SYSIN    DD  *                                               
 OPTION  VLSCMP                                                 
 INCLUDE COND=((2363,1,CH,NE,C'Y'),                             
           AND,((1,25000,SS,NE,C';0378; '),                     
               OR,(1,25000,SS,NE,C';0379; ')))                 
 INREC IFTHEN=(WHEN=INIT,                                       
       PARSE=(%01=(ABSPOS=1,STARTAT=C';0118;',ENDBEFR=C';0119;',
                 FIXLEN=40))),                                 
       IFTHEN=(WHEN=INIT,                                       
       PARSE=(%02=(ABSPOS=1,STARTAT=C';0004;',ENDBEFR=C';0005;',
                FIXLEN=35))),                                   
       IFTHEN=(WHEN=INIT,                                       
           PARSE=(%03=(ABSPOS=1,STARTAFT=C';0378;',ENDBEFR=C';',
                   FIXLEN=4))),                                 
       IFTHEN=(WHEN=NONE,                                       
            BUILD=(1:1,4,                                       
            %01,C'*', %02,C'&',C' 378 ',   %03,C'?'))                                         
   SORT FIELDS=COPY                                             
/*                                                             


Input file - TTFO.PQUQ.NPDARCH.PRPY.D24032.V2 :
Code:

NWBDM2I78742122 PROPAY  2024-02-01           GBPUBNINPI02584368;0117;E;0118;2024-02-01;0119;9999-12-31;0120;SHA;0121;N;0122; ;0377;N;0378;    ;0379;CODEWORD /RETN/ RECEIVED GO TO PAGE 4                                           ;0380;/RETN/  ;0381;N;0382;2433;0383;Same account number used for credit and debit 

Output file - TTFO.WARREPB.PPAY.ARCH.FUND.Y2024.QMU.ALL :
Code:

;0118;2024-02-01                        *    ?

The field 0118 is found but none of the others.
If I swap theme around so it looks for filed 0378 first it finds that but none of the others. So it seems to not parse after the first successful parse.

Many thanks
_________________
Peter Warren
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Sat Nov 02, 2024 2:24 am    Post subject: Reply with quote

peterwarren,


It is not clear as to what the real requirement is. Please answer the following questions

1. What is the LRECL and RECFM of the input file?
2. Can the records contain ALL 3 sets ? ie

Code:

a.).;0118;length of 40 bytes String;0119;
b.) ;0004;length of 35 bytes String;0005;
c.) ;0378;abcd;


3. or do the sets exist on different records?
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
peterwarren
Beginner


Joined: 12 Jul 2018
Posts: 2
Topics: 2

PostPosted: Mon Nov 04, 2024 2:28 am    Post subject: Reply Reply with quote

Hi,
input file :
Data Class: DSIZC500
Organization: PS-E
Record format: VB
Record length: 27185
Block size: 27966

The record can have any combination of these fields per record: either all, one or 2 or 0118, 0004, 0378. And are not in fixed positions

so I am trying to extract what is there by using the IFTHEN=(WHEN=INIT command which, according to google, should work .

Many thanks
_________________
Peter Warren
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Mon Nov 04, 2024 1:21 pm    Post subject: Reply with quote

peterwarren,

Try these untested control cards

Code:

//SYSIN    DD *                                   
  OPTION COPY,VLSCMP                             
  INCLUDE COND=((2363,1,CH,NE,C'Y'),             
           AND,((1,25000,SS,NE,C';0378; '),       
               OR,(1,25000,SS,NE,C';0379; ')))   
                                                 
  INREC IFTHEN=(WHEN=INIT,                       
               PARSE=(%01=(STARTAFT=C';0118;',   
                            ENDBEFR=C';0119;',   
                             FIXLEN=40)),         
               BUILD=(01,04,%01,C'*',5)),         
                                                 
        IFTHEN=(WHEN=INIT,                       
               PARSE=(%02=(STARTAFT=C';0004;',   
                            ENDBEFR=C';0005;',   
                             ABSPOS=46,           
                             FIXLEN=35)),         
               BUILD=(01,45,%02,C'&',5)),         
                                                 
        IFTHEN=(WHEN=INIT,                       
               PARSE=(%03=(STARTAFT=C';0378;',   
                            ENDBEFR=C';',         
                             ABSPOS=82,           
                             FIXLEN=04)),         
        BUILD=(01,81,%03,C'?'))                   
/*                                               

_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
peterwarren
Beginner


Joined: 12 Jul 2018
Posts: 2
Topics: 2

PostPosted: Tue Nov 05, 2024 3:12 am    Post subject: Many thanks Reply with quote

Many thanks, did exactly what I wanted.
_________________
Peter Warren
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group