ILE Conventions for Calling Any Program (*PGM)

If you have an ILE C/C++ program calling a program (*PGM), use the OS calling convention for ILE C/C++ in your ILE C/C++ source to tell the compiler that PGMNAME is an external program, not a bound ILE procedure.
Note: The OS calling convention for ILE C is the #pragma linkage (PGMNAME, OS) directive. The OS calling convention for ILE C++ is extern "OS".

This section provides examples that illustrate dynamic program call conventions for ILE C/C++ programs that call any external program. As shown in Table 1, ILE C uses the same convention when calling all external programs other than an EPM entry point.

Table 1. Dynamic Program Calling Conventions
Action Program Call Convention
ILE C calling *PGM where *PGM is
  • ILE C
  • OPM COBOL
  • OPM RPG
  • OPM CL
  • OPM BASIC
  • OPM PL/1
  • EPM C
  • EPM PASCAL
  • EPM FORTRAN;
  • ILE COBOL
  • ILE RPG
  • ILE CL
  • C++
#pragma linkage (PGMNAME, OS)
For example,
void PGMNAME(void);
#pragma linkage (PGMNAME, OS)
 /* Other code                      */
 /* Dynamic call to program PGMNAME */
PGMNAME();
ILE C calling an EPM entry point #pragma linkage (QPXXCALL, OS)
For example,
#include <xxenv.h>
 /* The xxenv.h header file holds                   */
 /* the prototype for QPXXCALL                      */
 /* The #pragma linkage (QPXXCALL, OS)              */
 /* is in this header file.                         */
 /* Other code.                                     */
 /* Dynamic call to program QPXXCALL.               */
 /* Dynamic call to EPM entry point using QPXXCALL: */
 /* the name of the entry point is entname, envid   */
 /* names the user-controlled environment, the      */
 /* program and library name is given by envpgm,    */
 /* parm1 and parm2 are arguments passed to entname. */
QPXXCALL(entname, envid, &envpgm, parm1, parm1);