Rational Developer for System z
Enterprise COBOL for z/OS, Version 4.1, Programming Guide


cob2 syntax and options

Read syntax diagramSkip visual syntax diagram
cob2 command syntax

>>-cob2--+---------+--filenames--------------------------------><
         '-options-'              

You can use the options listed below with the cob2 command. (Do not capitalize cob2.)

-bxxx
Passes the string xxx to the linker as parameters. xxx is a list of linker options in name=value format, separated by commas. You must spell out both the name and the value in full (except for the special cases noted below). The name and value are case insensitive. Do not use any spaces between -b and xxx.

If you do not specify a value for an option, a default value of YES is used except for the following options, which have the indicated default values:

  • LIST=NOIMPORT
  • ALIASES=ALL
  • COMPAT=CURRENT
  • DYNAM=DLL

One special value for xxx is dll, which specifies that the executable module is to be a DLL. This string is not passed to the linker.

-c
Compiles programs but does not link them.
-comprc_ok=n
Controls cob2 behavior on the return code from the compiler. If the return code is less than or equal to n, cob2 continues to the link step or, in the compile-only case, exits with a zero return code. If the return code returned by the compiler is greater than n, cob2 exits with the same return code. When the c89 command is implicitly invoked by cob2 for the link step, the exit value from the c89 command is used as the return code from the cob2 command.

The default is -comprc_ok=4.

-e xxx
Specifies the name of a program to be used as the entry point of the module. If you do not specify -e, the default entry point is the first program (file.cbl) or object file (file.o) that you specify as a file name on the cob2 command invocation.
-g
Prepares the program for debugging. Equivalent to specifying the TEST option with no suboptions.
-Ixxx
Adds a path xxx to the directories to be searched for copybooks for which you do not specify a library-name.

To specify multiple paths, either use multiple -I options, or use a colon to separate multiple path names within a single -I option value.

For COPY statements in which you have not coded an explicit library-name, the compiler searches for copybooks in this order:

  1. In the current directory
  2. In the paths you specify with the -I cob2 option
  3. In the paths you specify in the SYSLIB environment variable

If you use the COPY statement, you must ensure that the LIB compiler option is in effect.

-L xxx
Specifies the directory paths to be used to search for archive libraries specified by the -l operand.
-l xxx
Specifies the name of an archive library for the linker. The cob2 command searches for the name libxxx.a in the directories specified in the -L option, then in the usual search order. (This option is lowercase "el," not uppercase "eye.")
-o xxx
Names the object module xxx. If the -o option is not used, the name of the object module is a.out.
-qxxx
Passes xxx to the compiler, where xxx is a list of compiler options separated by blanks or commas.

Enclose xxx in quotation marks if a parenthesis is part of the option or suboption, or if you use blanks to separate options. Do not insert spaces between -q and xxx.

-v
Displays the generated commands that are issued by cob2 for the compile and link steps, including the options being passed, and executes them. This is sample output:
cob2 -v -o mini -qssrange mini.cbl
compiler: ATTCRCTL PARM=RENT,TERM,SSRANGE /u/userid/cobol/mini.cbl
PP 5655-S71 IBM Enterprise COBOL for z/OS  4.1.0  in progress ...
End of compilation 1,  program mini,  no statements flagged.
linker: /bin/c89 -o mini -e // mini.o
-#
Displays compile and link steps, but does not execute them.

Terms of use | Feedback

This information center is powered by Eclipse technology. (http://www.eclipse.org)