×
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 13-Oct-08, at 11:22 AM, rpg400-l-request@xxxxxxxxxxxx wrote:
I need to convert a char 16 field to binary 8. For example the filed
passed to my program is '539DE87D3BCF33FC' but I need it to be
x'539DE87D3BCF33FC'. I looked in the archives and found a
recommendation
to use cvthc but I couldn't get that working. Thanks.
Actually what you want is cvtch - not cvthc - I know it seems
backwards but ...
Here's an example - if you really want the result in a an 8 byte
binary then you can keep the generic prototype as shown and then place
the 20u 0 (8 byte binary) in a DS as shown - leave the prototype
alone. This version has not been tested but should be fine.
// cvtch MI instruction (Convert character to hex nibbles)
D FromHex PR ExtProc('cvtch')
D charVal 32766A OPTIONS(*VARSIZE)
D hexVal 65535A Const OPTIONS(*VARSIZE)
D srcLen 10I 0 Value
D inputHex s 36a
D outputChar DS
D bin8 20i 0
/Free
dsply 'Input hex ' ' ' inputHex;
FromHex(outputChar: inputHex: %Len(%TrimR(inputHex)));
dsply ('bin8 value is: ' + %Char(bin8));
Jon Paris
www.Partner400.com
www.SystemiDeveloper.com
As an Amazon Associate we earn from qualifying purchases.
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.