× 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 22/11/2008, at 5:29 AM, GKern@xxxxxxxxxxxxxxxx wrote:

I'm trying to use the prototypes referred to in the earlier post. Here is
my test code. The second callp results in the following errors. I've tried
setting the third parm to both 7 and 14. What am I doing wrong?

A domain error in a math function occurred.
Function check. C2M3001 unmonitored by A at statement 0000002100,
instruction X'0000'.
The call to cvtch ended in error (C G D F).


There are a number of things wrong with your code. Part of the confusion likely stems from misinterpreting what these instruction do. CVTHC converts the internal (i.e., hex) representation to character form thus ABC becomes C1C2C3 (presuming EBCDIC 37 encoding). CVTCH converts the character form to the internal (i.e., hex) form thus C1C2C3 becomes ABC. Seems to me nearly everyone cocks this up because they don't read the MI documentation for the instructions before they attempt to use them.


1) D MERC_MI_Hex S 20 INZ(x'4D4552435F4D49')

This should not have the leading x. Your code is defining a hexadecimal value which the compiler will store in 7 bytes. The CVTCH instruction is expecting a character representation of the hexadecimal contents. Thus:

D MERC_MI_Hex S 20 INZ('4D4552435F4D49')

Which occupies 14 bytes.

NOTE: This is also the ASCII representation. Is that what you wanted?


2) C CALLP ToHex(ToHexRtnVal : MERC_MI : 7)

The length is wrong. CVTHC expects the length in nibbles (or nybbles if you prefer) so this should be 14.


3) C CALLP FromHex(FrHexRtnVal : MERC_MI_Hex : 7)

The length is wrong. CVTCH expects the length in bytes which in this case is 14. That is, it is the length of the character form of the hexadecimal value.



I suspect the cause of the domain error is because your MERC_MI_Hex variable contains values other than 0-9 and A-F. Removing the leading x will likely correct things.

Regards,
Simon Coulter.
--------------------------------------------------------------------
FlyByNight Software OS/400, i5/OS Technical Specialists

http://www.flybynight.com.au/
Phone: +61 2 6657 8251 Mobile: +61 0411 091 400 /"\
Fax: +61 2 6657 8251 \ /
X
ASCII Ribbon campaign against HTML E-Mail / \
--------------------------------------------------------------------




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.