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




On Thursday, February 12, 2004, at 07:57 AM, Malchow, Grizzly wrote:


I'm trying to convert a numeric value to a binary value and I stress the
word trying. I'm using the itoa function to try this. First can anyone
tell me if this is possible? Second can anyone tell me where I could
find some good information on the itoa function as it relates to RPGIV?

Check the archives. I am sure you will find appropriate prototypes and examples.


Finally does anyone have any suggestion, tips, secrets, or anything in
regards to converting numeric values to binary values?

There is no secret, just assign it!


D binVal     S                  10I  0
D packedVal  S                  10   0   INZ(1234)
D zonedVal   S                  10S  0   INZ(9876)

C               EVAL binVal = packedVal
C               EVAL binVal = zonedVal
C               EVAL binVal = -1234
C               EVAL binVal = %SIZE(packedVal)
C               EVAL binVal = %ELEM(some-array)
C               EVAL binVal = %DECPOS(packedVal)

etc. etc. etc.

You only need atoi() and its ilk when converting a character field to a numeric (i.e., trying to extract a usable number from character data).

Regards,
Simon Coulter.
--------------------------------------------------------------------
   FlyByNight Software         AS/400 Technical Specialists

   http://www.flybynight.com.au/
   Phone: +61 3 9419 0175   Mobile: +61 0411 091 400        /"\
   Fax:   +61 3 9419 0175                                   \ /
                                                             X
                 ASCII Ribbon campaign against HTML E-Mail  / \
--------------------------------------------------------------------



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.