|
Hello, The problem is that the 3rd parm to cvthc() needs to be passed by VALUE.CL programs can't pass a parameter by value in V5R2 (However, they can in V5R3.)
PGM
Dcl &OutHexChar *CHAR 20
Dcl &InChar *CHAR 10 '1234567890'
Dcl &LenC *CHAR 4
Dcl &Len *DEC (10 0) 20
chgvar (%BIN(&LENC)) &Len
callPRC ('cvthc') Parm(&OutHexChar &InChar &LenC)
dmpclpgm
ENDPGM
In this example, you're passing the address of &LenC to the cvthc routine. The cvthc routine isn't expecting an address, it's expecting a value, so you have problems.
The possible solutions are to upgrade to V5R3, or to use a different language that DOES support passing parms by value (I could tell you how to do this in C or RPG, and I expect that it's also possible in COBOL)
In V5R3 ILE CL, it would look like this:
PGM
Dcl &OutHexChar *CHAR 20
Dcl &InChar *CHAR 10 '1234567890'
Dcl &LenC *CHAR 4
Dcl &Len *DEC (10 0) 20
ChgVar (%bin(&LenC)) value(&Len)
callPRC ('cvthc') Parm(&OutHexChar &InChar (&LenC *BYVAL))
dmpclpgm
ENDPGM
When I run this, I get the following:
Variable Type Length Value
*...+....1....+....2....+
&INCHAR *CHAR 10 '1234567890'
&LEN *DEC 10 0 20
&LENC *CHAR 4 ' '
&OUTHEXCHAR *CHAR 20 'F1F2F3F4F5F6F7F8F9F0'
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.