Coding COBOL programs to run under CICS

To code a program to run under CICS®, code CICS commands in the PROCEDURE DIVISION by using the EXEC CICS command format.


EXEC CICS command-name command-options
END-EXEC

CICS commands have the basic format shown above. Within EXEC commands, use the space as a word separator; do not use a comma or a semicolon. Do not code COBOL statements within EXEC CICS commands.

Restriction: You cannot run COBOL programs that have object-oriented syntax for Java™ interoperability in CICS. In addition, if you write programs to run under CICS, do not use the following code:
  • FILE-CONTROL entry in the ENVIRONMENT DIVISION, unless the FILE-CONTROL entry is used for a SORT statement
  • FILE SECTION of the DATA DIVISION, unless the FILE SECTION is used for a SORT statement
  • User-specified parameters to the main program
  • USE declaratives (except USE FOR DEBUGGING)
  • These COBOL language statements:
    • ACCEPT format 1: data transfer (you can use format-2 ACCEPT to retrieve the system date and time)
    • CLOSE
    • DELETE
    • DISPLAY UPON CONSOLE
    • DISPLAY UPON SYSPUNCH
    • MERGE
    • OPEN
    • READ
    • RERUN
    • REWRITE
    • START
    • STOP literal
    • WRITE

If you plan to use the separate CICS translator, you must put any REPLACE statements that contain EXEC commands after the PROCEDURE DIVISION header for the program, otherwise the commands will not be translated.

Coding file input and output: You must use CICS commands for most input and output processing. Therefore, do not describe files or code any OPEN, CLOSE, READ, START, REWRITE, WRITE, or DELETE statements. Instead, use CICS commands to retrieve, update, insert, and delete data.

Coding a COBOL program to run above the 16 MB line: Under Enterprise COBOL, the following restrictions apply when you code a COBOL program to run above the 16 MB line:

  • If you use IMS/ESA® without DBCTL, DL/I CALL statements are supported only if all the data passed in the call resides below the 16 MB line. Therefore, you must specify the DATA(24) compiler option. However, if you use IMS/ESA with DBCTL, you can use the DATA(31) compiler option instead and pass data that resides above the 16 MB line.

    If you use EXEC DLI instead of DL/I CALL statements, you can specify DATA(31) regardless of the level of the IMS product.

  • If the receiving program is link-edited with AMODE 31, addresses that are passed must be 31 bits long, or 24 bits long with the leftmost byte set to zeros.
  • If the receiving program is link-edited with AMODE 24, addresses that are passed must be 24 bits long.

Displaying the contents of data items: DISPLAY to the system logical output device (SYSOUT, SYSLIST, SYSLST) is supported under CICS. The DISPLAY output is written to the Language Environment® message file (transient data queue CESE). DISPLAY . . . UPON CONSOLE and DISPLAY . . . UPON SYSPUNCH, however, are not allowed. You can specify the DISPSIGN option to control output formatting for DISPLAY of signed numeric items.

related concepts  
Integrated CICS translator