CONTROLLING YOUR COMPILATION - IBM Mainframe

As noted before, the compiler's main job is to translate your COBOL program into language that the computer can process (object code). The compiler also lists errors in your source statements and provides supplementary information to help you debug and tune your program. You can direct and control compilation with the following:

  • Compiler-directing statements
  • Compiler options

Compiler-Directing Statements

Several statements help you to direct the compilation of your program.

  • BASIS statement - This extended Source program library statement provides a complete COBOL program as the source for a compilation.
  • "CONTROL (*CBL) statement - This compiler-directing statement selectively suppresses or allows output to be produced. The names "CONTROL and *CBL ace synonymous.
  • COPY statement - This library statement places prewritten text in a COBOL program.
  • DELETE statement - This extended source library statement removes COBOL statements from the BASIS source program.
  • EJECT statement - This compiler-directing statement specifies that the next source statement is to be printed at the top of the next page.
  • ENTER statement - The VS COBOL II compiler treats this statement as a comment.
  • INSERT statement - This library statement adds COBOL statements to the BASIS source program.
  • REPLACE statement - This statement is used to replace source program text.
  • SERVICE LABEL statement - This statement is generated by the CICS translator to indicate control flow. It is not intended for general use.
  • SKIP1/2/3 statement - These statements specify lines to be skipped in the source listing.
  • TITLE statement - This statement specifies that a title (header) be printed at the top of each page of the source listing.
  • USE statement - The USE statement provides declaratives to specify the following:
    1. Error-handling procedures - EXCEPTION/ERROR
    2. User label-handling procedures - LABEL
    3. Debugging lines and sections - DEBUGGING.

Compiler Options

Compiler options help to control the compilation of your program. Specify these options in the PARM field of the JCL or on the PROCESS statement in your program (see below). Or, under TSO, specify options through parameters (arguments) on the command that starts the compilation. Most of the options come in pairs. You select one or the other. For example, the option pair for a cross-reference listing is XREF/NOXREF. If you want such a listing, specify XREF. If you do not want one, specify NOXREF. Some options have sub-parameters. For example, if you want 44 lines per page on your listings, specify LINECOUNT(44).

The PROCESS (Synonym: CBL) Statement

You can code compiler options on the PROCESS statement. The PROCESS statement is placed before the Identification Division header and has the following format:

Compiler Options

One or more blanks must separate PROCESS and the first option. Separate options with a comma or a blank. The PROCESS statement must be placed before any comment lines or compiler-directing statements. There must not be any embedded space within options. For example, FLAG (x,y) may not be written FLAG(x y).

PROCESS can start in columns 1 through 66. A sequence field is allowed in columns 1 through 6. When used with a sequence field, PROCESS can start in columns 8 through 66. If used, the sequence field must contain six characters, and the first character must be numeric.

You can use CBL as a synonym for PROCESS. CBL can start in columns 1 through 70. When used with a sequence field, CBL can start in columns 8 through 70.

You can use more than one PROCESS statement. If multiple PROCESS statements are used, they must follow one another with no intervening statement of any other type. Options cannot be continued across multiple PROCESS statements. Your programming installation can inhibit the use of PROCESS statements with the default options module of the COBOL compiler. When PROCESS statements are found in a COBOL program where they are-not allowed by the installation, the COBOL compiler generates error diagnostics.

Selecting Compiler Options

You can specify compiler options in several different ways, depending on the system you are using for compilation:

  • With the PARM parameter of the EXEC statement in your job control procedure
  • Under TSO through an ISPF panel
  • With a PROCESS (or CBL) statement preceding your Identification Division header

Default Values for Compiler Options

The default options that were set up when your compiler was installed will be in effect for your program unless you override them with other options. (In some installations, certain compiler options are set up as fixed so that you cannot override them. If you have problems, see your system administrator.) To find out the default compiler options in effect, run a test compilation without specifying any options. The output listing will list the default options specified by your installation.

Precedence of Compiler Options

Compiler options are recognized in the order of precedence below:

  • Level 1: (Highest precedence) Installation defaults, fixed by your installation
  • Level 2: Those on PROCESS (or CBL) statements
  • Level 3: Those on the JCL PARM parameter or the TSO CALL command
  • Level 4: (Lowest precedence) Installation defaults, but not fixed

Within this hierarchy of precedence, there are also rules for conflicting and mutually exclusive options.

Conflicting Compiler Options

The positive form of the compiler option and its negative form, for example, DECK and NODECK, are opposing options. If you specify both of them on the same level in the hierarchy listed above, the option specified last takes effect. For example, within your PROCESS (or CBL) statement or within your JCL PARM= statement, the option specified last takes effect. In addition to the directly opposing options, a few of the compiler options are mutually exclusive. That is, when you specify one of the options in column A of the following table, the option in column B is normally ignored, and the option in column C is forced on. For example, if you specify both OFFSET and LIST in your PROCESS statement in any order OFFSET takes effect and LIST is ignored. However, results can vary depending on the level at which you specify the option.

For example, if you specify OFFSET in your JCL statement but LIST in your PROCESS statement, LIST will take effect because the options specified in the PROCESS statement and any options forced on by an option specified in the PROCESS statement have higher precedence.

What if one of the options from column A is set up as a default for your system and you want to use a conflicting option from column B? It is possible that an option may be set up at the installation level as a fixed option, in which case the options it conflicts with cannot be put into effect by individual programmers.

But if the option from column A is a non-fixed default option, you can put a conflicting option from column B in effect by specifying it on your PROCESS statement or in your JCL PARM= statement.

Mutually exclusive options at the same level of prescedence

For example, if OFFSET is your system default (non-fixed) but You want to use LIST for your program, you can do so by specifying LIST in your PROCESS statement or JCL PARM=statement. If TEST is your system default (non-fixed) and If NORES is specified in your JCL and if RENT and DYNAM are specified in your PROCESS statement, then the resulting options will be TEST, RENT, DYNAM, and RES. Why? TEST would normally force RES, because TEST and NORES are mutually exclusive options. NORES specified on the JCL PARM statement could override the RES that TEST forced. But the specification of RENT in your PROCESS statement forces RES on, overriding the JCL card.

If RENT is specified in your JCL, and if NORES is specified in your PROCESS statement, then the resulting options in effect will be NORENT and NQJES. Why? Because the NORES option specified in the PROCESS statement is mutually exclusive with the RENT option, and options specified in the PROCESS statement have higher precedence than options specified on the JCL. If, however, RENT were a fixed installation default, RES would be forced into effect and the NORES specified in the PROCESS statement would, because of lower precedence, have no effect.

Performance Considerations with Compiler Options

There are a number of performance considerations you should be aware of when using compiler options. The DYNAM. FASTSRT, FDUMP, OPTIMIZE, NUMPROC, RENT. RESIDENT, SSRANGE, TEST, and TRUNC compiler options can all affect run-time performance.

Option Settings for COBOL 85 Standard Compilation

The following compiler options are required to conform to COBOL 85 Standard specification:

  • ADV
  • NOCMPR2
  • NODBCS
  • DYNAM
  • NOFASTSRT
  • NOFLAGMIG
  • NOFLAGSAA
  • FLAGSTD(H)
  • LIB
  • NAME(ALIAS) or NAME(NOALIAS)
  • NONUMBER
  • NUMPROC(NOPFD) or NUMPROC(MIG)
  • QUOTE
  • RESIDENT
  • NOSEQUENCE
  • TRUNC(STD)
  • NOWORD
  • ZWB

In addition, the run-time option A1XBLD must be specified.


All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

IBM Mainframe Topics