The CPI-C-COBOL program interface largely corresponds to the C interface described in section “CPI-C calls in UPIC”. You can therefore consult this description when creating CPI-C programs in COBOL. This section groups together the special features of the COBOL interface which apply for the data structures and CPI-C calls.
COPY element CMCOBOL
The COPY element CMCOBOL, which contains the condition variables and names, is supplied for CPI-C applications in COBOL. After installation of the UPIC carrier system, you will find CMCOBOL
on Window systems in the file upic-dir\
copy-cobol
or upic-dir\netcobol
directoryon Unix and Linux systems in the directory upic-dir
/copy-cobol85
orupic-dir
/copy-netcobol
on BS2000 systems in the library returned by the following SDF-P function
INSTALLATION-PATH(INSTALLATION-UNIT='UTM-CLIENT',LOGICAL-ID='SYSLIB',DEFAULT-PATH-NAME='*UNKNOWN')
CMCOBOL must be included in the WORKING-STORAGE-SECTION using the COPY statement. The names of constants are derived from the C names only through the use of hyphens instead of underscores, e.g. “CM-SEND-RECEIVED” instead of “CM_SEND_RECEIVED”.
The name TIME-OUT or TIMEOUT is used in CMCOBOL for the CPI-C interface as a result of the CPI-C specification. These words are reserved by Micro Focus, so this name must be modified in the source, for example using the following statement:
COPY CMCOBOL REPLACING TIME-OUT BY CPIC-TIMEOUT
CPI-C calls in COBOL
The function names are identical in C and COBOL. The following applies for the parameters of the CPI-C calls:
As is normal in COBOL, the parameters must be transferred by reference.
Each variable in the parameter list must begin with the level number 01.
Numerical data must be in the COMP format that produces the same binary format as with C on the respective machine.
When using COBOL on Windows systems you must bear in mind the necessary call conventions for the dynamic library (DLL).
... WORKING-STORAGE-SECTION. ************************* COPY CMCOBOL. ... PROCEDURE DIVISION. ************************* ... CALL "CMINIT" USING CONVERSATION-ID,SYM-DEST-NAME,CM-RETCODE.