|
You should be able to set values in a C program as long as CL program passes in the variable. You simply need to dereference the argv parameter and set it, i.e.: *argv[3] = rrn; Elvis -----Original Message----- From: c400-l-bounces@xxxxxxxxxxxx [mailto:c400-l-bounces@xxxxxxxxxxxx] On Behalf Of Chris Wolcott Sent: Friday, October 01, 2004 12:29 PM To: c400-l@xxxxxxxxxxxx Subject: RE: [C400-L] RE: Passing parameter back to calling CL 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... _______________________________________________ This is the C programming iSeries / AS400 (C400-L) mailing list To post a message email: C400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/c400-l or email: C400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/c400-l.
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.