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




If it's documentation you want try the old site... http://publib.boulder.ibm.com/pubs/html/as400/online/homeeng1.htm

These functions are documenteed in this book...
ILE C/C++ MI Library Reference: SC09-2418
http://publib.boulder.ibm.com/pubs/pdfs/as400/V3R7PDF/qbjadr00.pdf


Barbara's use of short & long helps to avoid IBM's confusing usage of hex & char. To some of us, Hex means a hexidecimal representation (ie. 0-9,A-F) but with these commands Hex means binary and Char means hex characters. Bin & Hex would have been a better choice.



Keith



Dave Murvin wrote:
I have been looking through the archives for information on converting characters to hex. I found several sample prototypes such as the following from Barbara Morris:

    D cvthex1To2       Pr                  Extproc('cvthc')
     D  longReceiver                   *   Value
     D  shortSource                    *   Value
     D  receiverBytes                10i 0 Value

     D cvthex2To1       Pr                  Extproc('cvtch')
     D  shortReceiver                  *   Value
     D  longSource                     *   Value
     D  sourceBytes                  10i 0 Value

What I have not been able to find is where these procedures are documented so I can figure out how to use this type of procedure (and other C function procedures) myself. When I search the Info Center for the Convert Character to Hex procedure, what I get is the following, which does not look like the prototypes to me.


Convert Character to Hex (CVTCH)


Op Code (Hex) Operand 1 Operand 2

1082 Receiver Source

Operand 1: Character variable scalar.

Operand 2: Character variable scalar.

Description: Each character (8-bit value) of the string value in the source operand is converted to a hex digit (4-bit value) and placed in the receiver operand. The source operand characters must relate to valid hex digits or a conversion (hex 0C01) exception is signaled.
Characters Hex Digits
Hex F0-hex F9 Hex 0-hex 9
Hex C1-hex C6 Hex A-hex F
The operation begins with the two operands left-adjusted and proceeds left to right until all the hex digits of the receiver operand have been filled. If the source operand is too small, it is logically padded on the right with zero characters (hex F0). If the source operand is too large, a length conformance (hex 0C08) exception or an invalid operand length (hex 2A0A) exception is signaled.


Substring operand references that allow for a null substring reference (a length value of zero) may be specified for operands 1 and 2. The effect of specifying a null substring reference for the source is that the bytes of the receiver are each set with a value of hex 00. The effect of specifying a null substring reference for the receiver is that no result is set.

Is there a manual on this? If so, can someone let me know where to find it? I have looked at the ILE C/C++ run time library manual and these functions do not appear to be there.

Thanks for the help.


Dave Murvin DRM Enterprises, Inc.

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.