IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Denomination counts by using PARSE in ICETOOL


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
savan

New User


Joined: 22 May 2008
Posts: 4
Location: Canada

PostPosted: Mon Jul 21, 2025 10:16 pm
Reply with quote

I have a request where we need to find the denomination counts of $100, $50, $20, $10, $5 and populate in the output by using PARSE in ICETOOL.

Input
Denomination starts at 22nd position and with no proper sequence.
Ex:- 2x10 = 2 notes of $10.
Here x is in lower case(i.e hex (A7))

Required Output
Sequence of the denomination counts in output should populate from 22nd position with starting counts for $100, $50, $20, $10, $5
Back to top
View user's profile Send private message
savan

New User


Joined: 22 May 2008
Posts: 4
Location: Canada

PostPosted: Tue Jul 22, 2025 12:57 am
Reply with quote

[Input

----+----1----+----2----+----3----+----4----+----5--
*************************** Top of Data ******
EMPLY1 2025-07-20 2x10,1x100,5x20,3x5,2x50
EMPLY1 2025-07-20 8x100,1x20,1x5,2x50
EMPLY2 2025-07-20 8x20,3x50
EMPLY3 2025-07-20 2x10,1x100,4x20,2x50
EMPLY3 2025-07-20 6x20,1x5 ]

[Required Output

----+----1----+----2----+----3----+----4----+----5
********************************* Top of Data ****
EMPLY1 2025-07-20 0001 0002 0005 0002 0003
EMPLY1 2025-07-20 0008 0002 0001 0000 0001
EMPLY2 2025-07-20 0000 0003 0008 0000 0000
EMPLY3 2025-07-20 0001 0002 0004 0002 0000
EMPLY3 2025-07-20 0000 0000 0006 0000 0001 ]

Not able to attach the screenshot. Above is the input and output file.
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1429
Location: Bamberg, Germany

PostPosted: Tue Jul 22, 2025 11:00 am
Reply with quote

Please as always, make use of the code tags when presenting code/data, and the preview button. icon_exclaim.gif

Sample:
Code:
  INREC IFTHEN=(WHEN=INIT,                                           
    PARSE=(%=(ABSPOS=19),                                           
           %01=(STARTAT=NUM,ENDBEFR=C'x',FIXLEN=4),                 
           %11=(STARTAT=NUM,ENDBEFR=C',',ENDBEFR=BLANKS,FIXLEN=3),   
           %02=(STARTAT=NUM,ENDBEFR=C'x',FIXLEN=4),                 
           %21=(STARTAT=NUM,ENDBEFR=C',',ENDBEFR=BLANKS,FIXLEN=3),   
           %03=(STARTAT=NUM,ENDBEFR=C'x',FIXLEN=4),                 
           %31=(STARTAT=NUM,ENDBEFR=C',',ENDBEFR=BLANKS,FIXLEN=3),   
           %04=(STARTAT=NUM,ENDBEFR=C'x',FIXLEN=4),                 
           %41=(STARTAT=NUM,ENDBEFR=C',',ENDBEFR=BLANKS,FIXLEN=3),   
           %05=(STARTAT=NUM,ENDBEFR=C'x',FIXLEN=4),                 
           %51=(STARTAT=NUM,ENDBEFR=C',',ENDBEFR=BLANKS,FIXLEN=3)), 
    BUILD=(1,18,                                                     
           %11,UFF,M10,LENGTH=3,%01,UFF,M11,LENGTH=4,               
           %21,UFF,M10,LENGTH=3,%02,UFF,M11,LENGTH=4,               
           %31,UFF,M10,LENGTH=3,%03,UFF,M11,LENGTH=4,               
           %41,UFF,M10,LENGTH=3,%04,UFF,M11,LENGTH=4,               
           %51,UFF,M10,LENGTH=3,%05,UFF,M11,LENGTH=4)),             
    IFTHEN=(WHEN=(19,3,ZD,EQ,+100),OVERLAY=(54:22,4),HIT=NEXT),     
    IFTHEN=(WHEN=(19,3,ZD,EQ,+50),OVERLAY=(58:22,4),HIT=NEXT),       
    IFTHEN=(WHEN=(19,3,ZD,EQ,+20),OVERLAY=(62:22,4),HIT=NEXT),       
    IFTHEN=(WHEN=(19,3,ZD,EQ,+10),OVERLAY=(66:22,4),HIT=NEXT),       
    IFTHEN=(WHEN=(19,3,ZD,EQ,+5),OVERLAY=(70:22,4),HIT=NEXT),       
    IFTHEN=(WHEN=(26,3,ZD,EQ,+100),OVERLAY=(54:29,4),HIT=NEXT),     
    IFTHEN=(WHEN=(26,3,ZD,EQ,+50),OVERLAY=(58:29,4),HIT=NEXT),       
    IFTHEN=(WHEN=(26,3,ZD,EQ,+20),OVERLAY=(62:29,4),HIT=NEXT),       
    IFTHEN=(WHEN=(26,3,ZD,EQ,+10),OVERLAY=(66:29,4),HIT=NEXT),       
    IFTHEN=(WHEN=(26,3,ZD,EQ,+5),OVERLAY=(70:29,4),HIT=NEXT),       
    IFTHEN=(WHEN=(33,3,ZD,EQ,+100),OVERLAY=(54:36,4),HIT=NEXT),     
    IFTHEN=(WHEN=(33,3,ZD,EQ,+50),OVERLAY=(58:36,4),HIT=NEXT),       
    IFTHEN=(WHEN=(33,3,ZD,EQ,+20),OVERLAY=(62:36,4),HIT=NEXT),       
    IFTHEN=(WHEN=(33,3,ZD,EQ,+10),OVERLAY=(66:36,4),HIT=NEXT),       
    IFTHEN=(WHEN=(33,3,ZD,EQ,+5),OVERLAY=(70:36,4),HIT=NEXT),       
    IFTHEN=(WHEN=(40,3,ZD,EQ,+100),OVERLAY=(54:43,4),HIT=NEXT),     
    IFTHEN=(WHEN=(40,3,ZD,EQ,+50),OVERLAY=(58:43,4),HIT=NEXT),       
    IFTHEN=(WHEN=(40,3,ZD,EQ,+20),OVERLAY=(62:43,4),HIT=NEXT),       
    IFTHEN=(WHEN=(40,3,ZD,EQ,+10),OVERLAY=(66:43,4),HIT=NEXT),       
    IFTHEN=(WHEN=(40,3,ZD,EQ,+5),OVERLAY=(70:43,4),HIT=NEXT),       
    IFTHEN=(WHEN=(47,3,ZD,EQ,+100),OVERLAY=(54:50,4)),
    IFTHEN=(WHEN=(47,3,ZD,EQ,+50),OVERLAY=(58:50,4)), 
    IFTHEN=(WHEN=(47,3,ZD,EQ,+20),OVERLAY=(62:50,4)), 
    IFTHEN=(WHEN=(47,3,ZD,EQ,+10),OVERLAY=(66:50,4)), 
    IFTHEN=(WHEN=(47,3,ZD,EQ,+5),OVERLAY=(70:50,4))   
  OUTFIL FNAMES=(SORTOUT),                             
    REMOVECC,                                         
    BUILD=(1,18,                                       
           54,4,ZD,M11,X,                             
           58,4,ZD,M11,X,                             
           62,4,ZD,M11,X,                             
           66,4,ZD,M11,X,                             
           70,4,ZD,M11)                               
  END

Output:
Code:
****** ***************************** Top of Data *****
000001 EMPLY1 2025-07-20 0001 0002 0005 0002 0003     
000002 EMPLY1 2025-07-20 0008 0002 0001 0000 0001     
000003 EMPLY2 2025-07-20 0000 0003 0008 0000 0000     
000004 EMPLY3 2025-07-20 0001 0002 0004 0002 0000     
000005 EMPLY3 2025-07-20 0000 0000 0006 0000 0001     
****** **************************** Bottom of Data ***
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1429
Location: Bamberg, Germany

PostPosted: Tue Jul 22, 2025 7:21 pm
Reply with quote

What you might need to consider is multiple entries of the same type for one record. It's not that difficult to take care for that as well. Also if you want to "optimize" the number of bills for each type, it's possible.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2264
Location: USA

PostPosted: Tue Jul 22, 2025 8:52 pm
Reply with quote

Now 99.99% of all new posts do appear in this format:
Quote:
I have a request (from my management) to do (this, this, and this).

The input is as follows (... ... ... ... ...)
The output is as follows (... ... ... ... ...).


In some (very few) cases this "post" is ending with
Quote:
Please help me (perform my own job which I'm paid for)


Almost never it is even ending with
Quote:
Thank you very much for any help.


And there are absolutely no example of any attempt to do AT LEAST SOMETHING by the topic starter himself!!!


Do you consider it is a normal way of communication at the technical help forum??? icon_pray.gif 12.gif 2020.gif
Back to top
View user's profile Send private message
savan

New User


Joined: 22 May 2008
Posts: 4
Location: Canada

PostPosted: Wed Jul 23, 2025 9:00 am
Reply with quote

Thank you very much for the details "Joerg.Findeisen" . I did modify few things and it worked very well.

Also, we are not expecting multiple entries of the same type in one record.

Thanks again.
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1429
Location: Bamberg, Germany

PostPosted: Wed Jul 23, 2025 10:58 am
Reply with quote

Mind to share what you have modified?
Back to top
View user's profile Send private message
savan

New User


Joined: 22 May 2008
Posts: 4
Location: Canada

PostPosted: Sat Aug 02, 2025 1:22 am
Reply with quote

Hi Joerg.Findeisen, I have used REPEAT option something like as below

Code:

INREC  IFTHEN=(WHEN=INIT,               
             PARSE=(%1=(ABSPOS=19,ENDBEFR=X'A7',ENDBEFR=BLANKS,FIXLEN=4),         
                    %2=(STARTAFT=C',',ENDBEFR=X'A7',ENDBEFR=BLANKS,FIXLEN=4,REPEAT=4))),
       IFTHEN=(WHEN=INIT,               
             PARSE=(%=(ABSPOS=19),%6=(STARTAFT=X'A7',ENDBEFR=C',', ENDBEFR=BLANKS, FIXLEN=4,REPEAT=5))),


Thanks.
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1429
Location: Bamberg, Germany

PostPosted: Mon Aug 04, 2025 1:06 am
Reply with quote

If you want to make use of REPEAT, with FIXLEN=4 for all fields, you can code it more efficiently. Only one IFTHEN is needed to do the PARSE.
Back to top
View user's profile Send private message
View previous topic : : View next topic  
Post new topic   Reply to topic All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts ICETOOL to SUM String DFSORT/ICETOOL 1
No new posts ICETOOL returns no records JCL & VSAM 1
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
No new posts Shift left VB record without x00 endi... DFSORT/ICETOOL 11
No new posts how to calculate SUM value for VB fil... DFSORT/ICETOOL 1
Search our Forums:


Back to Top