cob2 syntax and options
You can use the options listed below with the cob2
command.
(Do not capitalize cob2
.)
If you specify cob2
without
any options or input files, the compiler manual page will be displayed.
-b
xxx- 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 thec89
command is implicitly invoked bycob2
for the link step, the exit value from thec89
command is used as the return code from thecob2
command.The default is -comprc_ok=4.
-dbrmlib=
xxx- Specifies the location to be used for
the generated database request module (DBRM). Only valid when the
SQL
compiler option is also specified.- When xxx is not specified, the DBRM is written
to a z/OS UNIX file.
If the input file for the compile operation is named
file.cbl
, then the DBRM file will be namedfile.dbrm
. - When xxx is specified, xxx represents the name of an existing data set that will hold the generated DBRM. Note that the provided name xxx is used as-is with no extra qualification performed.
- When xxx is not specified, the DBRM is written
to a z/OS UNIX file.
If the input file for the compile operation is named
-e
xxx- Specifies
the name of the program to be used as the entry point of the module.
The program must be one of the programs that will be included in 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 thecob2
command invocation. -g
- Prepares
the program for debugging. Equivalent to specifying the
TEST
option with no suboptions. -help
- Displays the manual page of the compiler. If you specify
cob2 -help
, regardless of whether you provide input files, the compiler manual page is displayed and the compilation stops. This option has the same effect as-?
. -I
xxx- 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 the following order:- In the current directory
- In the paths you specify with the
-I cob2
option - In the paths you specify in the SYSLIB environment variable
- In the locations specified in instances of the
COPYLOC
option that use the default library name or specify an explicit library name of SYSLIB
-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 l, not uppercase I.) -o
xxx- Names
the object module xxx. If the
-o
option is not used, the name of the object module is a.out. -q
xxx- 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. Here is sample output:cob2 -v -o mini -qssrange mini.cbl compiler: ATTCRCTL PARM=RENT,TERM,SSRANGE /u/userid/cobol/mini.cbl PP 5655-EC6 IBM Enterprise COBOL for z/OS 6.3.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.
-?
- Displays
the manual page of the compiler. If you specify
cob2 -?
, regardless of whether you provide input files, the compiler manual page is displayed and the compilation stops. This option has the same effect as-help
.