Compiler options for programs that run under CICS

Table 1 lists the compiler options for Enterprise COBOL programs that run under CICS®.

Table 1. Compiler options for programs that run under CICS
Compiler options Comments
CICS The CICS compiler option enables the integrated CICS translator capability. The CICS option must be specified if the source program contains CICS statements and has not been processed by the separate CICS translator.

The CICS option requires that the NODYNAM and RENT options also are in effect. Enterprise COBOL forces on these options if DYNAM, or NORENT are specified at the same level as the CICS option.

The CICS translator option COBOL3 is recommended, although COBOL2 is still supported.

Choose the COBOL2 option if you are retranslating old programs that require the use of temporary variables. In particular, note that the use of temporary variables might circumvent errors that would normally occur when an argument value in a program is incorrectly defined. The COBOL2 option provides declarations of temporary variables. Because of this feature, incorrect definitions of argument values might be present, but not noticeable at run time, in programs that were translated with COBOL2. Translating these programs with the COBOL3 option can reveal these errors for the first time.

For example, suppose you coded:

                                                                
        EXEC CICS LINK PROGRAM('XXXXXXX')                        
                       COMMAREA(WS-COMMAREA)                     
                       LENGTH('1000')                            
        END-EXEC.                                                

The length is supposed to be a binary halfword but because it is enclosed in quotation marks, it is a character string. With COBOL3 the character string will be passed directly to CICS on the CALL and will result in an error. With the COBOL2 option the length will be moved to an intermediate variable and COBOL will convert it from character string to binary halfword as part of the move. To assist with migration to the newer releases of CICS, you can use the COBOL2 option to continue to circumvent errors in the programs, rather than correcting them.

If the NOCICS option is in effect, any CICS statements found will be flagged with S-level diagnostics and discarded.

DBCS The DBCS option is the default for Enterprise COBOL. It might cause problems for CICS programs if you are using the COBOL2 CICS translator option. The fix is to use the COBOL3 translator option.
NODYNAM
NODYNAM is required for programs translated by the CICS translator because the CICS command-level stub cannot be dynamically called.
Note: Dynamic calls are supported under CICS by the use of the CALL identifier format of the CALL statement, or by the use of the >>CALLINTERFACE DYNAM directive.
RENT RENT is required for CICS programs. RENT causes the compiler to produce reentrant code and allows you to place the COBOL modules in the LPA (Link PackAarea) or ELPA (Extended Link Pack Area) and thus shared among multiple address spaces under CICS. Also, the modules cannot be overwritten, since the LPA and ELPA are read-only storage.
TRUNC Use TRUNC(OPT) for CICS programs that contain EXEC CICS commands, if the program uses binary data items in a way that conforms to the PICTURE and USAGE clause for them.

Use TRUNC(BIN) if your program uses binary data items in a way that does not conform to the PICTURE and USAGE clause for them. For example, if a data item is defined as PIC S9(8) BINARY and might receive a value greater than eight digits, use TRUNC(BIN). You can also use TRUNC(OPT) and redefine specific items as COMP-5 to improve runtime performance for the whole program.