Open PL/I follows the native C compiler's naming conventions. This allows you to mix subroutines and functions compiled with Open PL/I with any other language or third party library that supports a C language interface. You must link the Open PL/I run-time libraries into the final stand-alone program. Micro Focus fully documents inter-language calling between COBOL/2 and C. In general, you should follow the Micro Focus directions for mixing COBOL and C, simply treating the modules compiled with Open PL/I as C modules. The following test program illustrates a COBOL program that calls a PL/I function, passing a string as an argument.
COBOL source code module:
WORKING-STORAGE SECTION. 01 STR PIC X(20). * PROCEDURE DIVISION. CALL-PL1 SECTION. DISPLAY "Calling the PL/I program". CALL "PL1PROC" USING STR. DISPLAY "Return from PL/I program". DISPLAY STR. STOP RUN.
PL/I source code module:
PL1PROC: PROCEDURE ( CHARSTR ); DECLARE CHARSTR CHARACTER(20); CHARSTR = 'This is a real test!'; END PL1PROC;
Commands to compile and link:
On Windows:
mfplx mfpl1.pl1 –c -fpcobol cbllink mfcob.cbl mfpl1.obj –omf “%MFPLI_PRODUCT_DIR%”\lib\mfplimd.lib