Previous Topic Next topic Print topic


Open PL/I and Micro Focus

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.

The 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.

The PL/I source code module:

PL1PROC: PROCEDURE ( CHARSTR );
DECLARE CHARSTR CHARACTER(20); 

CHARSTR = 'This is a real test!'; 

END PL1PROC;

The commands to compile and link:

mfplx mfpll.pl1 -stat -c 

cob mfcob.cbl mfpl1.o -o mf -v -V -x \ 
    /pl1dir/lib/dflock.o071030 \ 
    /pl1dir/lib/noofm.o071030\ 
    /pl1dir/lib/lpi.a071030

Note that the names and locations of the Open PL/I libraries are specific to your version of Open PL/I. This illustrates a typical installation.

Previous Topic Next topic Print topic