|
On Mon, Sep 9, 2019 at 7:47 AM David Gibbs <david@xxxxxxxxxxxx> wrote:
Does anyone have a routine handy (or know of an API) that will convertI think I solved my own problem.
hex characters to decimal or integer?
For example: If I have the character value 'BC614E' I would get
12345678 returned.
There is an api to do what I want ... I just misunderstood what it does.
cvtch will convert hex to a number. I was under the impression that it
only converted hex numbers (F0-F9) into a numeric field. Turns out it
will convert any hex into it's binary equivalent.
**free
ctl-opt dftactgrp(*no);
dcl-pr cvtch extproc('cvtch');
dest pointer value;
src pointer value;
len int(10) value;
end-pr;
dcl-s hexValue char (8) inz('00BC614E');
dcl-s binValue int (10);
dcl-s len int(10);
len = %len(hexValue);
cvtch(%addr(binValue):%addr(hexValue):len);
*inlr = *on;
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.