Hi,
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!
Thanks,
Sandy
EZT - Data conversion from Alphanumeric to Packed decimal
-
- Global moderator
- Posts: 3025
- Joined: Sun Jul 04, 2010 12:13 am
- Skillset: JCL, PL/1, Rexx, Utilities and to a lesser extent (i.e. I have programmed using them) COBOL,DB2,IMS
- Referer: Google
- Location: Pushing up the daisies (almost)
Re: EZT - Data conversion from Alphanumeric to Packed decima
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.
Regards
Nic
Regards
Nic
-
- Global moderator
- Posts: 3805
- Joined: Tue Jan 25, 2011 12:02 am
- Skillset: Easytrieve Plus, Cobol, Utilities, that sort of stuff
- Referer: Google
Re: EZT - Data conversion from Alphanumeric to Packed decima
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).
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).
-
- Similar Topics
- Replies
- Views
- Last post
-
- 2
- 4142
-
by sergeyken
View the latest post
Tue Aug 02, 2022 4:07 am
-
-
Array processing and Table handling with packed decimal
by rogerstrycova » Tue Oct 26, 2021 3:55 pm » in IBM Cobol - 2
- 1726
-
by Robert Sample
View the latest post
Wed Oct 27, 2021 1:12 am
-
-
- 7
- 2019
-
by sergeyken
View the latest post
Wed Dec 23, 2020 6:39 pm
-
-
sort card to add zeros to varying alphanumeric field.
by longfall » Thu Mar 09, 2023 12:03 am » in DFSORT/ICETOOL/ICEGENER - 1
- 1841
-
by sergeyken
View the latest post
Thu Mar 09, 2023 2:04 am
-
-
-
How to sum a decimal value using sort
by hkaur7087 » Thu Aug 05, 2021 2:19 pm » in DFSORT/ICETOOL/ICEGENER - 4
- 2366
-
by sergeyken
View the latest post
Thu Aug 05, 2021 7:48 pm
-