× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hi Armand,

Instead of using MOVE to pass the numeric field to alpha, use %char to
convert it to alpha.
This will convert a negative number correctly to alpha, like "-22256".
Then you can still use %int to convert it back.

Opcode MOVE simple moves bytes, it doesn't know about (negative) numbers.

Coincidentally (well not really), in EBCDIC a byte representing a character
"1" is the same as a byte representing a zoned numeric 1, which is hex F1.
So MOVE works coincidentally, with alpha fields and zoned numeric fields as
long as the number is positive. The "F" in F1 indicates it's "unsigned", a
"C" indicates it's positive and "D" indicates it's negative. The "sign" in
a zoned field is represented in the last byte (least significant). Thats
why you get the letter "O", which is hex D6, representing the digit 6 in a
negative number.


On Fri, Jan 25, 2013 at 11:04 AM, Armand Perquin <a.perquin@xxxxxxxxxxxxx>wrote:

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.
______________________________________________________________________

--
This is the RPG programming on the IBM i (AS/400 and iSeries) (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.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 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.