|
View previous topic :: View next topic
|
| Author |
Message |
savan
New User
Joined: 22 May 2008 Posts: 4 Location: Canada
|
|
|
|
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 |
|
 |
savan
New User
Joined: 22 May 2008 Posts: 4 Location: Canada
|
|
|
|
[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 |
|
 |
Joerg.Findeisen
Senior Member

Joined: 15 Aug 2015 Posts: 1429 Location: Bamberg, Germany
|
|
|
|
Please as always, make use of the code tags when presenting code/data, and the preview button.
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 |
|
 |
Joerg.Findeisen
Senior Member

Joined: 15 Aug 2015 Posts: 1429 Location: Bamberg, Germany
|
|
|
|
| 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 |
|
 |
sergeyken
Senior Member

Joined: 29 Apr 2008 Posts: 2264 Location: USA
|
|
|
|
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???  |
|
| Back to top |
|
 |
savan
New User
Joined: 22 May 2008 Posts: 4 Location: Canada
|
|
|
|
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 |
|
 |
Joerg.Findeisen
Senior Member

Joined: 15 Aug 2015 Posts: 1429 Location: Bamberg, Germany
|
|
|
|
| Mind to share what you have modified? |
|
| Back to top |
|
 |
savan
New User
Joined: 22 May 2008 Posts: 4 Location: Canada
|
|
|
|
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 |
|
 |
Joerg.Findeisen
Senior Member

Joined: 15 Aug 2015 Posts: 1429 Location: Bamberg, Germany
|
|
|
|
| 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 |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|