COBOL programming restrictions and requirements

Some restrictions and requirements apply to a COBOL program that is used as a CICS® application program.

By default, the CICS translator and the COBOL compiler do not detect the use of COBOL words that are affected by the following restrictions. The use of a restricted word in a CICS environment might cause a failure at execution time. However, COBOL provides a reserved-word table, IGYCCICS, for CICS application programs. If you specify the compiler option WORD(CICS) , the compiler uses the IGYCCICS table, and the compiler flags COBOL words that are not supported under CICS with an error message. The COBOL words that are normally restricted by the default IBM-supplied reserved-word table are also flagged. For a current listing of the words that are restricted and are in the IGYCCICS table, see Enterprise COBOL for z/OS Programming Guide .

Functions and statements that cannot be used

  • You cannot use entry points in COBOL in CICS.
  • 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.
  • Do not use a format-1 ACCEPT statement in a CICS program. Format-2 ACCEPT statements are supported by Language Environment® enabled compilers.
  • Do not use DISPLAY . . . UPON CONSOLE and DISPLAY . . . UPON SYSPUNCH. DISPLAY to the system logical output device (SYSOUT, SYSLIST,SYSLST) is supported.
  • Do not use STOP "literal".
  • Restrictions apply to the use of the SORT statement; see Enterprise COBOL for z/OS Programming Guide . Do not use MERGE.
  • Do not use the following:
    • USE declaratives.
    • ENVIRONMENT DIVISION and FILE SECTION entries associated with data management, because CICS handles data management. You can use these entries when they are associated with the limited SORT facility, listed previously.
    • User-specified parameters to the main program.

Coding requirements

  • When a debugging line is to be used as a comment, it must not contain any unmatched quotation marks.
  • Statements that produce variable-length areas, such as OCCURS DEPENDING ON, should be used with caution within the WORKING-STORAGE SECTION.
  • Do not use EXEC CICS commands in a Declaratives Section.
  • Start both EXEC CICS and END-EXEC statements in Area B (columns 12-71). Note that the integrated CICS translator does not produce an error message when an EXEC CICS statement starts in Area A (columns 8-11), because the keyword EXEC may be used in Area A as part of other statements, such as SQL statements.
  • If no IDENTIFICATION DIVISION is present, only the CICS commands are expanded. If the IDENTIFICATION DIVISION only is present, only DFHEIVAR, DFHEIBLK, and DFHCOMMAREA are produced.
  • For VS COBOL II programs with Language Environment runtime, the following limits apply to the length of WORKING-STORAGE:
    • When the compiler option DATA(24) is used, the limit is the available space below the 16 MB line.
    • When the compiler option DATA(31) is used, the limit is 128 MB.
    For storage accounting and save areas, 80 bytes are required; you must include this in the limits.
  • If the DLI option is specified and an ENTRY statement immediately follows the PROCEDURE DIVISION header in an existing program, change the PROGRAM-ID name to the ENTRY statement literal and delete the ENTRY statement before calling the program in CICS.
  • If you use HANDLE CONDITION or HANDLE AID, you can avoid addressing problems by using SET(ADDRESS OF A-DATA) or SET(A-POINTER) where A-DATA is a structure in the LINKAGE SECTION and A-POINTER is defined with the USAGE IS POINTER clause.

Language Environment coding requirements

If you are running CICS applications written in COBOL under Language Environment for the first time, you might need to review the Language Environment runtime options in use at your installation. In particular, if your applications are not coded to ensure that the WORKING-STORAGE SECTION is properly initialized (for example, cleared with binary zeros before sending maps), you should use the STORAGE runtime option. For information about customizing Language Environment runtime options, see z/OS Language Environment Programming Reference.

31-bit addressing

For a COBOL program running above the 16 MB line, the following restrictions apply for 31-bit addressing:
  • If the receiving program is link-edited with AMODE(31), addresses passed to it must be 31 bits long (or 24 bits long with the left-most byte set to zeros).
  • If the receiving program is link-edited with AMODE(24), addresses passed to it must be 24 bits long.
Specify the DATA(24) compiler option for programs running in 31-bit addressing mode that are passing data arguments to programs in 24-bit addressing mode. This ensures that the data will be addressable by the called program.

64-bit addressing

64-bit addressing mode is not supported for COBOL programs.

Compiler options

  • Do not use the following compiler options:
    • DYNAM (if program is to be translated)
    • NOLIB (if program is to be translated)
    • NORENT
    You may use the DLL compiler option.
  • The following compiler options have no effect in a CICS environment:
    • ADV
    • AWO
    • EXPORTALL
    • FASTSRT
    • NAME
    • OOCOBOL
    • OUTDD
    • THREAD
  • The use of the TEST(SYM,NOSEPARATE) compiler option results in a very large increase in program size. Therefore, short-on-storage problems may occur when using this option. You can achieve the same functionality with TEST(SYM,SEPARATE) without an increase in program size. For more information about the TEST compiler option, see the Enterprise COBOL for z/OS Programming Guide .
  • Use TRUNC(OPT) for handling binary data items if they conform to the PICTURE definitions. Otherwise, use TRUNC(OPT) as the compiler option and USAGE COMP-5 for items where the binary value might be larger than the PICTURE clause would allow. TRUNC(BIN) inhibits runtime performance, so use this option only if you have no control over binary data items (such as those created by a code generator). (TRUNC(STD) is the default.)

    Note that if your application uses fields in the EIB, the DFHEIBLK copybook defines fields such as EIBCALEN as PICTURE S9(4) USAGE COMPUTATIONAL. Using the TRUNC(OPT) compiler option with the DFHEIBLK copybook can result in the truncation of values greater than 9999 in binary fields. To avoid truncation problems, you are recommended to use the integrated translator which uses an updated version of the DFHEIBLK copybook. The version of DFHEIBLK used by the integrated translator defines all fields that would be affected by the TRUNC(OPT) or TRUNC(BIN) compile option as USAGE COMP-5.

    For more information about the TRUNC option, see the Enterprise COBOL for z/OS Customization Guide.

  • The use of the RMODE(24) compiler option means that the program always resides below the 16 MB line, so this is not recommended. RMODE(ANY) or RMODE(AUTO) should be used instead. For more information about the RMODE compiler option, see the Enterprise COBOL for z/OS Programming Guide .

WITH DEBUGGING MODE

If a "D" is placed in column seven of the first line of a COBOL EXEC CICS command, that "D" is also found in the translated CALL statements. This translated command is only executed if WITH DEBUGGING MODE is specified. A "D" placed on any line other than the first line of the EXEC CICS statement is not required and is ignored by the translator.



dfhp3_cobol_prog.html | Timestamp icon Last updated: Monday, 5 June 2017