EZT - Data conversion from Alphanumeric to Packed decimal

Unicenter CA-Easytrieve Plus Report Generator: CA's information retrieval and data management tool

EZT - Data conversion from Alphanumeric to Packed decimal

Postby Sandy » Fri May 16, 2014 2:45 am


New to EZT. Need help.

I have an input file that contains amount field from column 102 to 111 (i.e, alphanumeric 10). It can contain -ve values too.
It is variable length. For example it can contain '-500.00' or '1234567.00'.

The EZT pgm has to read this amount field from input file and move it to a packed decimal field AMT1 W 8 P 2.
I am using this packed decimal to update the amount field in a db2 table. The amount field in the table has its datatype defined as DECIMAL(15,2). Hence I need to define my AMT1 as W 8 P 2. Otherwise I am getting datatype error while updating it.

Please help!

Posts: 1
Joined: Fri May 16, 2014 2:35 am
Has thanked: 0 time
Been thanked: 0 time

Re: EZT - Data conversion from Alphanumeric to Packed decima

Postby NicC » Fri May 16, 2014 12:35 pm

If all your easytrieve is doing is converting that one field then you would be better off using your sort product - but I will leave others to judge on that.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Global moderator
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: EZT - Data conversion from Alphanumeric to Packed decima

Postby BillyBoyo » Fri May 16, 2014 1:37 pm

To convert that field in Easytrieve Plus, you'd need to write some code, a loop starting at the right, ignoring blanks. You'll have to transfer from first non-blank, byte at a time, ignoring ".", into a numeric (N) field that is redefined as A with the OCCURS. You need to make sure your receiving field starts are zero. When you arrive at a -, set a flag, if you find no sign, set the flag to something else.

Testing the flag, set you packed-decimal field to either the numeric field you've just populated or (0 - the numeric field you've just populated).

Or use SORT, which has SFF, a format for a Signed Free-Format field (which is what you have).
Global moderator
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Return to CA-Easytrieve


  • Related topics
    Last post