Calling to or from COBOL programs

You can make calls to or from VS COBOL II, COBOL for MVS™ & VM, COBOL for OS/390® & VM, and Enterprise COBOL programs by using the CALL statement.

If you are calling a separately compiled COBOL program that was processed with either the separate CICS® translator or the integrated CICS translator, you must pass DFHEIBLK and DFHCOMMAREA as the first two parameters in the CALL statement.

Called programs that are processed by the separate CICS translator or the integrated CICS translator can contain any function that is supported by CICS for the language.

Dynamic calls:

You can use COBOL dynamic calls when running under CICS. If a COBOL program contains EXEC CICS statements or contains EXEC SQL statements, the NODYNAM compiler option is required. To dynamically call a program in this case, you can use CALL identifier with the NODYNAM compiler option.

If a COBOL program contains no EXEC CICS statements and contains no EXEC SQL statements, there is no requirement to compile with NODYNAM. To dynamically call a program in this case, you can use either CALL literal with the DYNAM compiler option, or CALL identifier.

Note: END-EXEC cannot be followed by a period when it is associated with EXEC CICS statements even though it is required for EXEC SQL statements.

You must define dynamically called programs in the CICS program processing table (PPT) if you are not using CICS autoinstall. Under CICS, COBOL programs do not support dynamic calls to subprograms that have the RELOAD=YES option coded in their CICS PROGRAM definition. Dynamic calls to programs that are defined with RELOAD=YES can cause a storage shortage. Use the RELOAD=NO option for programs that are to be dynamically called by COBOL.

Interlanguage communication (ILC):

Support for ILC with other high-level languages is available. Where ILC is not supported, you can use CICS LINK, XCTL, and RETURN instead.

The following table shows the calling relationship between COBOL and assembler programs. In the table, assembler programs that conform to the interface that is described in the Language Environment Programming Guide are called Language Environment®-conforming assembler programs. Those that do not conform to the interface are non-Language Environment-conforming assembler programs.

Table 1. Calls between COBOL and assembler under CICS
Calls between COBOL and assembler programs Language Environment-conforming assembler program Non-Language Environment-conforming assembler program
From an Enterprise COBOL program to the assembler program? Yes Yes
From the assembler program to an Enterprise COBOL program? Yes No

Nested programs:

When you compile with the integrated CICS translator, the translator generates the DFHEIBLK and DFHCOMMAREA control blocks with the GLOBAL clause in the outermost program. Therefore if you code nested programs, you do not have to pass these control blocks as arguments on calls to the nested programs.

If you code nested programs and you plan to use the separate CICS translator, pass DFHEIBLK and DFHCOMMAREA as parameters to the nested programs that contain EXEC commands or references to the EXEC interface block (EIB). You must pass the same parameters also to any program that forms part of the control hierarchy between such a program and its top-level program.

Start of changeFor detailed information and examples on calling COBOL programs under CICS, see Calling subprograms from COBOL programs in Developing CICS Applications.End of change

Related concepts  
Integrated CICS translator

Related tasks  
Using the separate CICS translator  
Choosing the DYNAM or NODYNAM compiler option  
Handling errors when calling programs
ILC under CICS (Language Environment Writing Interlanguage Communication Applications)
The external CICS interface (CICS Transaction Server for z/OS® External Interfaces Guide)

Related references