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



Thank you Barbara! That was it! Thank you for reigniting the ol' synapses!

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Barbara Morris
Sent: Friday, September 21, 2012 1:48 PM
To: rpg400-l@xxxxxxxxxxxx
Subject: Re: Converting an into to hex to char

On 2012/9/21 3:54 PM, Monnier, Gary wrote:

Using msgnbr or msgnbrchar with cvtch() throws C2M3001 so I know I
have to convert msgnbr to a hex value.

My quandary is how in the world do I convert integer 9488 to hex value
x'2510' so I can use cvtch() to convert x'2510' to character value
'2510'?


cvthc() is the one that takes x'2510' and converts it to '2510'. cvtch() goes the other way.

D cvthc PR extproc('cvthc')
D long_target * value
D short_src * value
D tgt_length 10I 0 value
D msgid ds
D prefix 3a
D num 4a
/free
prefix = facility;
cvthc (%addr(num) : %addr(msgnbr) : 4);

I have a new mnemonic for these functions to help me remember what h and c stand for. "hex" is a small word and "character" is a long word, so cvthc, convert from hex to character, is the conversion that goes from small to big, 2 byte x'2510' to 4 byte '2510'. And vice versa.

--
Barbara
--
This is the RPG programming on the IBM i / System i (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.