I've done this for some programs using a based variables.
D Program1 PI
D parmField1 5A
P PTRparmSigned S * INZ(%ADDR(parmField1))
D parmSigned S 5S 0 BASED(PTRparmSigned)
Monitor;
Field1 = parmSigned;
On-error;
// parmField1 did not have valid signed data.
Endmon;
The calling program can still do the Move or it can use %EDITC( FLD :'X').
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 Armand Perquin
Sent: Friday, January 25, 2013 3:04 AM
To: rpg400-l@xxxxxxxxxxxx
Subject: Lost in free format conversion.
Hello,
In a RPG3 program a numeric field is converted to a character field and passed as parameter in a call. When this parameter is received in a free format program and the value is positive there is no problem converting it back to a numeric field. But when the value was negative the value in the character field contains a letter so I can convert it to a numeric field with %dec, %int or %uns.
E.g.
Field1 5.0 with value -22256 and parmField1 5A.
When the value from Field1 in RPG3 is moved into parmField1 the value is
converted from -22256 to '2225O'. In this case converting it back to a
numeric field is not possible because of the letter ‘O’. The result is
message RNX0105 is trown.
Can someone please help me to solve this challenge in free format.
Best Regards / Met vriendelijke groet,
Armand
_____________________________________________
H.P.J. (Armand) Perquin
AS/400 Senior software developer, Senior system analyst
Boal Beheer B.V.
De Hondert Margen 12
PO Box 75, 2678 ZH De Lier, The Netherlands
Tel. +31 (0)174 527297, Fax. +31 (0)174 527264
Internet:
http://www.boalgroup.com
This message (including any attachments) is confidential and may be
privileged. If you have received it by mistake please notify the sender by
return e-mail and delete this message from your system. Any unauthorised
use or dissemination of this message in whole or in part is strictly
prohibited. Please note that e-mails are susceptible to change. BOAL
International B.V., which has its seat at De Lier, the Netherlands, and is
registered in the Commercial Register under number 27237488, including its
group companies, shall not be liable for the improper or incomplete
transmission of the information contained in this communication nor for
any delay in its receipt or damage to your system. BOAL International
B.V.(or its group companies) does not guarantee that the integrity of this
communication has been maintained nor that this communication is free of
viruses, interceptions or interference.
______________________________________________________________________
This email has been scanned by the Symantec Email Security.cloud service.
______________________________________________________________________
As an Amazon Associate we earn from qualifying purchases.