|
Writing my first program in C in the ILE environment and I am really
puzzled.
I have the following RPG program that is calling a C function, but all i get
back is a Null each time. If i put it in debug mode i can see that the value
of chkdigit is correct, but then, when i get it back in my RPG, the value is
NULL.
Can someone point out what i am doing wrong ?
RPG program
D Pr_ChkDigit PR * ExtProc('Pr_ChkDigit')
D * Options(*string) value
D Wrk_Str s 36A
D Wrk_Null s 1A Inz(X'00')
D Wrk_ChkDigit s 1A
D Ptr_ChkDigit s * INZ(%ADDR(Wrk_ChkDigit))
/Free
Wrk_Str = '70500607050AEI02x' + Wrk_Null;
Ptr_ChkDigit = Pr_ChkDigit(%Addr(Wrk_Str));
Dsply Wrk_ChkDigit;
*InLr = *on;
/End-Free
C service program
// Mod 36 Check bit calculator
char* Pr_ChkDigit(char *str)
{
char chkdigit;
char* check_bit;
//Calcuations
// Get checkbit from the Mapping Matrix
chkdigit=reverse_map(c1,c2) ;
*check_bit = chkdigit;
return check_bit;
}
--
Krish Thirumalai
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.