Hi, everybody.
Reading AS/400 manuals makes me sick.
Tried to understand how to return value from a C program to a CL.
That is CL program calls C program and C program wants to return value to it.
Actually C program is mine, so whatever value can be returned - string or integer.
It must be treated by CL as boolean - YES or NO.
If I call C program with a one parameter variable from CL and then modify this parameter in C, then the changed value will be available in CL on return. Yes?
But is there a way to receive the return() value?
That is if I complete my C program with return(172), then CL somehow knows, that 172 is returned?

Below is an extract from the manual (ILE/C programming guide, v.4, p.265-266), it should be the thing I'm looking for
----------------------------------------------
The following example shows how to retrieve a return value from main(). A CL
command called SQUARE calls an ILE C program SQITF. The program SQITF calls
another ILE C program called SQ. The program SQ returns a value to program
SQITF.
Note: Returning an integer value from an ILE C program may affect performance.
1. To create a CL command prompt SQUARE usng the source shown below, type:
CRTCMD CMD(MYLIB/SQUARE) PGM(MYLIB/SQITF) SRCFILE(MYLIB/QCMDSRC)

CMD PROMPT('CALCULATE THE SQUARE')
PARM KWD(VALUE) TYPE(*INT4) RSTD(*NO) RANGE(1 +
9999) MIN(1) ALWUNPRT(*YES) PROMPT('Value ')


You use the CL command prompt SQUARE to enter the item name, price, and
quantity for the ILE C program SQITF.
------------------------------------------------
But I cannot understand, where the command SQUARE calls C program SQIFT and HOW it reads returned value.
Sorry for my english, its not native. May be that's the problem :-(

Jevgeni.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2019 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].