|
Ok I've tried several variations using %DEC(). The program blows up
when trying to convert the packed data from a character field. For
example I have packed data that is a 4p1. I'm using %dec on the
substring value. The hex value for the 3 bytes are x'40400F'. The
packed data is in a char field in pos. 489-491. when the code:
number = %Dec(%trim(%Subst(Data:FieldDS(Ctr).InBuffer:
FieldDS(Ctr).Length)):63:31);
executes I get an error "character representation of a numeric value is
in error". Since the trimmed hex *should* be x'0F'. What's the problem?
Thanks,
Tommy Holden
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Joe Pluta
Sent: Friday, March 30, 2007 1:53 PM
To: 'RPG programming on the AS400 / iSeries'
Subject: RE: Decimals
Tommy, could you just stuff it into a huge field (like 63,15) and then
eval
the target field from the big field?
Joe
From: Holden Tommy
i'll end up using this kind of garbage:
Code:
select;
when FieldDS(Ctr).Decimals = 1;
number = %Dec(%trim(%subst(data:fieldds(ctr).InBuffer:
FieldDS(Ctr).Length)):30:1);
when FieldDS(Ctr).Decimals = 2;
number = %Dec(%trim(%subst(data:fieldds(ctr).InBuffer:
FieldDS(Ctr).Length)):30:2);
which is a major pain.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.