|
int main () { int rrn; /* do all your work */
return rrn; }
echo $?
Super easy.
On Fri, 1 Oct 2004, Chris Wolcott wrote:
My Bad. The way I showed you was if you were calling an exported procedure. (From a *MODULE or *SRVPGM) I rarely CALL a program anymore.
- = - = - = - = -
When creating a new CL, use CLLE for your Source Type. You may have to compile your CL as a *MODULE (use opt 15) and then use CRTPGM to create the final program.
Define the two variables as below, and use the CALLPRC command instead of the CALL command to run your C code. (You can prompt it if needed.)
The odd thing is you have to use the %BIN function twice. When used in the RTNVAL option, it tells the compiler that you will be getting back an integer. Since CL has no INT type, it is stored as a 4 byte character field. (Hence the defintion of &wrkINT as *CHAR 4) The CHGVAR use of %BIN actually changes the value to a packed format.
DCL VAR(&wrkINT ) TYPE(*CHAR) LEN( 4) DCL VAR(&RRN ) TYPE(*DEC ) LEN( 15 0)
CALLPRC PRC(program) PARM(parm1 parm2 . . . parmX) RTNVAL(%BIN(&wrkINT)) CHGVAR VAR(&RRN) VALUE(%BIN(&wrkINT))
- = - = - = - = -
RTVJOBATR can give you a return code from a CALLed program, but the help says just COBOL, RPG, DFU and sorts. I've never used it.
-----Original Message----- subject: RE:
Do you have or do you know where I can find an example of this approach? I'm not familiar with CLLE,so if I could see a sample, I could clone it...
James Rich
It's not the software that's free; it's you. - billyskank on Groklaw
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.