If Bywegt can be a zone type, I found it more readable to use DS overlay or
based pointer for this type of logic.
D DS
D Bywegt 5s 2
D Bxwegt 5 inz('01800') overlay(Bywegt)
or
D Bxwegt s 5 inz('01800')
D Bywegt s 5s 2 based(ByWegt_p)
D Bywegt_p s * inz(%addr(Bxwegt))
"Alan Shore" <AlanShore@xxxxxxxx> wrote in message
news:mailman.13157.1289405592.2702.rpg400-l@xxxxxxxxxxxxxxx
Thanks for your reply Richard
That was exactly what I was attempting to do (but failed miserably)
Now that my moron genes are in remission, I've got things moving along
Alan Shore
Programmer/Analyst, Direct Response
E:AShore@xxxxxxxx
P:(631) 200-5019
C:(631) 880-8640
"If you're going through Hell, keep going" - Winston Churchill
"Marion, Richard"
<richard.marion@w
incofoods.com> To
Sent by: "RPG programming on the IBM i /
rpg400-l-bounces@ System i" <rpg400-l@xxxxxxxxxxxx>
midrange.com cc
Subject
11/10/2010 10:45 RE: I thought I knew how %dec
AM worked
Please respond to
RPG programming
on the IBM i /
System i
<rpg400-l@midrang
e.com>
Are you trying to use the %DEC bif like the old fashion MOVE opcode?
Were you expecting to MOVE '01800' into a 5,2 field? Resulting in 18.00
numeric value?
The following will might be what you were attempting to do...
Bywegt = %Dec(Bxwegt :5:0)/100
Bywegt would contain 18.00
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of
Tommy.Holden@xxxxxxxxxxxxxxxxxxxxx
Sent: Wednesday, November 10, 2010 6:58 AM
To: RPG programming on the IBM i / System i
Subject: RE: I thought I knew how %dec worked
I'm sure you did but ... did you change the eval to %DEC( bxwegt:7:2)
after that change
Thanks,
Tommy Holden
From: Alan Shore <AlanShore@xxxxxxxx>
To: RPG programming on the IBM i / System i <rpg400-l@xxxxxxxxxxxx>
Cc: "'RPG programming on the IBM i / System i'"
<rpg400-l@xxxxxxxxxxxx>, rpg400-l-bounces@xxxxxxxxxxxx
Date: 11/10/2010 07:46 AM
Subject: RE: I thought I knew how %dec worked
Sent by: rpg400-l-bounces@xxxxxxxxxxxx
Thanks for your reply Dennis
as I replied to Joep
I'm still scratching my head
The field
d Bxwegt s 5 inz('01800')
Is really the value 18.00
I changed the code to
D Bywegt s 7p 2
with the same result RNX0103
Alan Shore
Programmer/Analyst, Direct Response
E:AShore@xxxxxxxx
P:(631) 200-5019
C:(631) 880-8640
"If you're going through Hell, keep going" - Winston Churchill
"Dennis Lovelady"
<iseries@lovelady
.com>
To
Sent by: "'RPG programming on the IBM i /
rpg400-l-bounces@ System i'"
<rpg400-l@xxxxxxxxxxxx>
midrange.com
cc
Subject
11/10/2010 08:42 RE: I thought I knew how %dec
AM worked
Please respond to
RPG programming
on the IBM i /
System i
<rpg400-l@midrang
e.com>
I believe you are trying to put 1800.00 into a field that cannot hold a
value greater than 999.99.
Dennis Lovelady
http://www.linkedin.com/in/dennislovelady
--
"Guidelines for Bureaucrats:
(1) When in charge ponder.
(2) When in trouble delegate.
(3) When in doubt mumble."
-- James H. Boren
Like the subject says, I thought I knew how %dec worked
Here is my code
d Bxwegt s 5 inz('01800')
D Bywegt s 5p 2
*-------------------------------------------------
* Stand Alone Fields - BOTTOM
*-------------------------------------------------
**************************************************
/FREE
Bywegt = %dec(Bxwegt: 5: 2);
*inlr = '1';
return;
/END-FREE
Pretty simple and straight forward, but when I run this, I get the
following error message
Message ID . . . . . . : RNX0103 Severity . . . . . . . :
99
Message type . . . . . : Diagnostic
Date sent . . . . . . : 11/10/10 Time sent . . . . . . :
13:00:14
Message . . . . : The target for a numeric operation is too small to
hold
the result.
Cause . . . . . : An arithmetic operation resulted in a value which
is
too
large to fit in the target. If this is a numeric expression, the
overflow
could be the result of the calculation of some intermediate result.
Recovery . . . : Either make the target of the operation larger or,
if
in
an expression, choose the precision of the operands in the
expression
so
that intermediate value will fit into the intermediate result.
I increased the field Bywegt to 6p 2, with the same result
Am I missing something?
Oh, before I forget (like I almost ALWAYS do) we are at V5r4
As always, any and all answers MUCH appreciated
--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing
list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at
http://archive.midrange.com/rpg400-l.
--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing
list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at
http://archive.midrange.com/rpg400-l.
--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing
list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at
http://archive.midrange.com/rpg400-l.
--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at
http://archive.midrange.com/rpg400-l.
As an Amazon Associate we earn from qualifying purchases.