In debug try these commands and post the result:
EVAL DS_HRESD01.D1CHGAMT :X
EVAL D1CHGAMT :X
I find it strange that your output from DS_HRESD01.D1CHGAMT is -793.49
when it should be -0000000793.49
Chris Hiebert
Programmer/Analyst
Disclaimer: Any views or opinions presented are solely those of the
author and do not necessarily represent those of the company.
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Florin Todor
Sent: Friday, May 10, 2013 7:57 AM
To: 'RPG programming on the IBM i (AS/400 and iSeries)'
Subject: RE: Eval-corr
Thank you for your e-mail, Barbara, and yes, I verified in debug session
that DS_HRESD01.D1CHGAMT has a negative value right before eval-corr and
the correspondent field has positive value right after eval-corr:
ds_hresD01 = f_in210txt;
// DS_HRESD01.D1CHGAMT = -793.49 <---- from Debug
session
eval-corr ds_detD01 = ds_hresD01;
// D1CHGAMT OF DS_DETD01 = 0000000793.49 <---- from Debug
session
Is it possible to be some PTF's missing here? We are in V6.1
Florin Todor
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Barbara Morris
Sent: Thursday, May 09, 2013 5:46 PM
To: rpg400-l@xxxxxxxxxxxx
Subject: Re: Eval-corr
On 5/9/2013 11:58 AM, Florin Todor wrote:
Did you have a chance to look at my code to see what am I doing wrong
here?
I forgot to add the DDS Description for the field, though; here it is:
D1CHGAMT 12P 2 COLHDG(' ' ' ' 'Charge')
It works fine for me. Here's my version of your program in debug:
1 D ds_detD01 e ds extname(testf:*output)
2=D D1CHGAMT 12P 2
3 D ds_hresD01 ds qualified inz
4 D D1CHGAMT 12 2
5 /free
6 DS_HRESD01.D1CHGAMT = -793.49;
7 eval-corr ds_detD01 = ds_hresD01;
8 return;
EVAL ds_detD01
D1CHGAMT OF DS_DETD01 = -0000000793.49
In your code, you are setting DS_HRESD01 by copying text to the data
structure.
ds_hresD01 = f_in210txt;
Have you verified in debug that DS_HRESD01.D1CHGAMT is -793.49 just
before the eval-corr?
If I had to guess, I'd guess that f_in210txt just has '000000079349',
but if the subfield is supposed to be negative, it should have the value
'00000007934R', ending in 'R', x'D9'. The x'D' in the last digit makes
the zoned value negative.
In my debug session:
EVAL ds_hresd01:c
DS_HRESD01:C = '00000007934R'
I'm guessing, maybe wrong, that yours would show
EVAL ds_hresd01:c
DS_HRESD01:C = '000000079349'
As an Amazon Associate we earn from qualifying purchases.