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



Ken, Alan's suggestion of dividing by 16 and then looking up in a 16-element
array was perfect.  255 = FF, 000 = 00.  It worked perfect.

The first problem of the parsing...  it turns out that the programmer was
trying to solve a problem that didn't exist.   

Gary G, Your soultion was far more complete a solution.but the truth is... I
am not a good enough programmer to implement it.  

Thank you all.  I now have color picker that returns color values in a
format for HTML, and its written in RPGIV.
 
 
---------------------------------------------------------
Booth Martin   http://www.MartinVT.com
Booth@xxxxxxxxxxxx
---------------------------------------------------------
 
-------Original Message-------
 
From: RPG programming on the AS400 / iSeries
Date: Wednesday, March 12, 2003 23:35:33
To: rpg400-l@xxxxxxxxxxxx
Subject: Re: numeric value(s) from alpha
 
Hi Booth -

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

I would use a finite state machine for parsing the data. That can validate 
as well as parse.

>After that, I need to convert the number to its hex equivalent.

Do you want to convert it to the actual hex value or to the character 
equivalent of the value? I.e. would 000 convert to x'00' or x'F0F0'?

If the actual hex value, you can use eight IFs with bit operations to do it.

If the character equivalent, the easiest way would be to have a 
compile-time array with 256 elements loaded with the character 
equivalents. The numeric value + 1 would point to the proper element.

Ken
http://www.ke9nr.net/
Opinions expressed are my own and do not necessarily represent the views of 
my employer or anyone in their right mind.

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.