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



I'm moving to free-format soon, and I think it's *got* to be
simpler than this, but "at least it should work":

..This here assumes the string is validated (hooboy)..That's
another story...

D hex     S    16   inz('0123456789ABCDEF')

 * For the 3 numbers, and the hex:
D nbr      S    3 0 dim( 03 )
D hexnbr S    2  dim( 03 )

 * STRG for the 00.000.0 string:
D strg     S    11  varying
D chars3 S     3

xa = 3

dou xa = 0
    chars3     = *all'0'
    move strg  chars3               /* <-- got to be "move"
*/
    xb  = %scan( dot:chars3 : 01 )   /* or ( dot  scan
chars3  xb )  */
    %subst(chars : xb) = *all'0'
    move chars3  nbr(xa)
    left#           = %div( nbr(xa) : 16 )
    right#         = %rem( nbr(xa) : 16 )
    hexnbr(xa) = %subst( hex : left# + 1 : 01 )
                     + %subst( hex : right# + 1 : 01 )
    xa = xa - 1
enddo




----- Original Message -----
From: "Booth Martin" <Booth@xxxxxxxxxxxx>
To: <rpg400-l@xxxxxxxxxxxx>
Sent: Tuesday, March 11, 2003 9:39 PM
Subject: numeric value(s) from alpha


|
|  Colors are coded by their red, green, blue values where
each value is 0
| through 255 (00 through ff in hex)
|
| A value might be 130:130:130  which is a gray, or it might
be 255:0:0 which
| would be a red-only.  White is 255:255:255 while black is
0:0:0   0.0.0 is
| the same as 000.000.000, and either notation is accepted.
|
| My need is to find each of these block's numerical value.
I am finding
| this extremely confusing for me as the field can vary from
5 to 11
| characters long.
|
| After that, I need to convert the number to its hex
equivalent.
|
| Any ideas would be appreciated.
|
| (yes, its an RPGIV question.)
| ---------------------------------------------------------
| Booth Martin   http://www.MartinVT.com
| Booth@xxxxxxxxxxxx
| ---------------------------------------------------------
|
|
| _______________________________________________
| This is the RPG programming on the AS400 / 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.