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



Using cvtch (the hex must be 8 characters long

___________________________________________________________________

D data DS
D i                             10i 0
D a                              4    overlay(data: 1)
D h               s              8
Dcvtch            PR                  EXTPROC('cvtch')
D                                1
D                                1
D                               10i 0 VALUE

  h = '00BC614E';
  dsply 'hex:' '' h;
  cvtch(a: h: 8);
  dsply 'int:' '' i;

   *inlr = *on;
_____________________________________________________________________

Output:

DSPLY  hex:    00BC614E
*N
DSPLY  int:      12345678
_____________________________________________________________________

On 9/11/19 1:33 AM, Roberto De Pedrini wrote:
But if you don't like API and love SQL ...take a look at this SQL statement

D usrf01 ds
D TypeCode 1 2s 0
D Category 3 4p 0
D Amount 5 8p 2

// get the amount and check the sign

select dec(
dec(substr(hex(substr(usrf01,5,4)),1,5)||'.'||
substr(hex(substr(usrf01,5,4)),6,2),
7,2) *
(case when substr(hex(substr(usrf01,5,4)),8,1) = 'D'
then -1 else 1 end),
7,2) as Price
from usrfldpf




https://www.itjungle.com/2005/01/19/fhg011905-story02/


Il giorno lun 9 set 2019 alle ore 14:47 David Gibbs via RPG400-L <
rpg400-l@xxxxxxxxxxxxxxxxxx> ha scritto:

Folks:

Does anyone have a routine handy (or know of an API) that will convert
hex characters to decimal or integer?

For example: If I have the character value 'BC614E' I would get
12345678 returned.

I had hoped there would be something in SQL, since there is a HEX
function that will convert a numeric into character hex, but it
doesn't appear to exist.

Thanks!

david

--
IBM i on Power Systems: For when you can't afford to be out of business!

I'm riding in the American Diabetes Association's Tour de Cure to
raise money for diabetes research, education, advocacy, and awareness.
You can make a tax-deductible donation to my ride by visiting
https://mideml.diabetessucks.net.

You can see where my donations come from by visiting my interactive
donation map ... https://mideml.diabetessucks.net/map (it's a geeky
thing).

I may have diabetes, but diabetes doesn't have me!
--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com



-- Este e-mail fue enviado desde el Mail Server del diario ABC Color -- -- Verificado por Anti-Virus Corporativo Symantec --

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.