Operation [ COBOL/HP-UX Operating Guide for the Series 700 and 800 ] MPE/iX 5.0 Documentation
COBOL/HP-UX Operating Guide for the Series 700 and 800
Operation
The Generator is invoked using the -N flag
on the cob command line (see Chapter 2 , COBOL System Interface).
This section shows you how to specify directives to the generator, either
when it is invoked or using a variety of other methods. The generating
process and segmented program handling are also explained.
Directives
Directives are used to specify options that affect the way the Native
Code Generator behaves, what output it produces, what code is actually
generated and how the generated code behaves when run. All directives
have a default built into the Native Code Generator; however, you can
create your own defaults as described in the section Setting Directives.
The following sections describe how you can specify generator directives.
Descriptions of the individual directives are contained in Appendix G
Directives for Compiler/Generator.
Directives Syntax.
Use the following format to specify generator directives:
-N [no]keyword"parameter"
where:
no turns keyword off. no applies only to certain
directives where specified in their description in
Appendix G , Directives for Compiler/Generator.
keyword is one or more of the Generator directives described
in Appendix G Directives for Compiler/Generator.
If you do specify more than one directive, they must
all be enclosed within quotation marks. This is
necessary to inform UNIX that all the directives
within them are grouped together. If you omit the
quotation marks, second and subsequent directives
are ignored although no warning to this effect is
given.
"parameter" is a qualifier to keyword and applies only to
certain directives where specified in their
description in Appendix G , Directives for
Compiler/Generator. It must appear in one of the
following forms:
"parameter"
or
=parameter
or
(parameter)
You must not include any spaces within a generator
option. This is because UNIX treats the space
character as an option delimiter. Therefore, if you
do include any spaces within a generator option,
UNIX considers that more than one has been
specified. If parameter is file- name, then it can
be a fully specified file-name, including path,
unless otherwise stated.
We recommend that where possible you use the format of the option that
contains an equal sign before any parameter. cob maps the equals sign
(which has no special meaning to UNIX) to the format which uses
parentheses (as these do have a special meaning to UNIX). You are
recommended to use this format because if you use either of the other
possible formats, you must escape the quotation marks or parentheses with
the backslash character (\) whenever they might be misinterpreted by the
UNIX shell. As the equals sign has no special meaning, it does not need
to be escaped.
In this manual, parameters appear in quotation marks.
Example
The following examples illustrate two ways to specify the same generator
options:
cob -N bound -N linkcheck pi.cbl
or
cob -N "bound linkcheck" pi.cbl
Both of these examples cause the Native Code Generator to check for
run-time limit violations and for the existence of each Linkage Section
item whenever it is referenced. The quotation marks in the second
example are necessary as they inform UNIX that all the material within
them is grouped behind the -N flag. If you omit the quotation marks,
second and subsequent directives are ignored, although no warning to this
effect is given.
Setting Directives.
Directives, which are specified prior to generating, can be entered in a
number of ways, and the order in which various options are passed to the
generator determines their precedence. Regardless of where they are
specified, Generator directives always follow the -N cob flag.
At startup, the cob command processes options in the following sequence:
1. Directives from the system-wide file $COBDIR/cobopt,
which is the first file processed when the generator is invoked.
2. Directives from optional user defaults defined in the environment
variable COBOPT.
3. Directives on the
cob command line.
The setting of directives specified in any of these ways override their
default settings. Additionally, later directives override earlier ones.
So, for example, specifying NOBOUND on the cob command line will override
BOUND in $COBDIR/cobopt.
Examples
The following examples illustrate the available methods of specifying
Generator directives.
* To specify the NOBOUND directive in the $COBDIR/cobopt file,
insert the line:
-N "nobound"
* To specify the NOCHECK LNKALIGN directives in the COBOPT
environment variable, enter:
COBOPT=-N "nocheck lnkalign"
* To specify the LNKALIGN directive on the cob command line for a
file called file1.cbl, enter:
cob -N lnkalign file1.cbl
For details on specifying options in any of these ways, see Chapter 2
, COBOL System Interface.
The Generating Process
If you do not specify the verbose option (-v cob flag), then the
generating process begins without displaying any messages, unless an
error is found.
If you do specify the verbose option on the cob command line, the Native
Code Generator accepts, rejects or ignores each option specified after
-v. Each option is acknowledged on a separate line. Those options
ignored are those which are not applicable to your environment. If any
options are rejected, the generating process stops.
After acknowledging all the options, the Native Code Generator opens its
files and starts to generate. At this point, it displays the message:
* Generating file-name
While generating your program, cob creates temporary files. These files
are placed in the directory indicated by the environment variable TMPDIR,
or in the directory /usr/tmp if TMPDIR does not exist (see Appendix I
, Environment Variables for details on TMPDIR). The size of these
files depends on the size of your program and the directives used. You
should ensure that there is enough free space in the temporary area
before starting the generation.
If the generator cannot open your source file, it issues the
message:
* File open failure: file-name
The generation is aborted and control is returned to UNIX. The most
likely causes of errors at this time are:
* you have not provided the correct file-name
* you have not provided the file extension (the extension must be
specified, even if it is .int)
* your file is not in the directory you have specified, it is not in
the current directory if you did not specify a path-name, or you
do not have the necessary access permission(s).
If no errors occur, then the system prompt reappears when the generating
process is complete.
Generating Segmented Programs
When you generate native code for a segmented program, you specify on the
cob command line only the name of the root segment intermediate code
file. The Native Code Generator uses this name and establishes from
internal tables which overlay segments are present and generates all the
segments in a single run. The output files mirror the input files: a
root generated code file with extension .gnt and overlays with extensions
.gnn, where nn is in the range 50-99 corresponding to the COBOL segment
numbers. The exception to this is when a program is generated for static
linking. In this instance, all the overlays are contained in the root
file, which has the extension .o. On some environments, a single .gnt
file is produced for a segmented program. This has no effect on the
running of the program.
MPE/iX 5.0 Documentation