z/OS Language Environment Writing Interlanguage Communication Applications
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


C fetching COBOL

z/OS Language Environment Writing Interlanguage Communication Applications
SA38-0684-00

You can use the C fetch() function to fetch a COBOL program and invoke it later using a function pointer. The declaration of a COBOL fetched program within a C routine is shown in Figure 1. The figure indicates C fetching either an Enterprise COBOL for z/OS or COBOL for OS/390 & VM program or a COBOL for MVS & VM program. If COBOL/370 or VS COBOL II were used, the C #pragma linkage directive would be used, as #pragma linkage(CBL_FUNC, COBOL).

Figure 1. C fetching a COBOL program
typedef void CBL_FUNC();
      .
      .
      .

CBL_FUNC *fetch_ptr;
fetch_ptr = (CBL_FUNC*) fetch("COBEP");   /* fetch the routine */
fetch_ptr(args);                          /* call COBEP        */

You can use the C release() function to release a COBOL program that was explicitly loaded by fetch(). A COBOL CANCEL cannot be issued against any routine dynamically loaded using the C fetch() function.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014