Compaq AAQ2G1FTK Marine Radio User Manual


 
Developing Compaq COBOL Programs
1.2 Developing Programs on Tru64 UNIX
The message-text may be on multiple lines and is sometimes accompanied by a
cobol
error.
Some common errors that occur during linking resemble the following:
An object module has compilation errors. This error occurs when you attempt
to link a module that had warnings or errors during compilation. Although
you can usually link compiled modules for which the compiler generated
messages, you should verify that the modules will actually produce the output
you expect.
The modules being linked define more than one transfer address. The linker
generates a warning if more than one main program has been defined. This
can occur, for example, when an extra END statement exists in the program.
The image file created by the linker in this case can be run; the entry point to
which control is transferred is the first one that the linker found.
A reference to a symbol name remains unresolved. This error occurs when
you omit required module or library names from the
cobol
or
ld
command
and the linker cannot locate the definition for a specified global symbol
reference.
If an error occurs when you link modules, you may be able to correct it by
retyping the command string and specifying the correct routines or libraries
(
-l
string flag,
-L
dir flag), or specify the object library or object modules on the
command line.
1.2.4 Running a Compaq COBOL Program on Tru64 UNIX
The simplest form of the run command to execute a program is to type its file
name at the operating system prompt, as follows:
% myprog.out
In addition to normal IO accesses, your Compaq COBOL programs can read
command-line arguments and access (read and write) environment variables.
1.2.4.1 Accessing Command-Line Arguments
Command-line arguments allow you to provide information to a program at
run time. Your program provides the logic to parse the command line, identify
command-line options, and act upon them. For example, you might develop a
program that will extract a given amount of data from a specified file, where both
the number of records to read and the file name are highly dynamic, changing
for each activation of your program. In this case your program would contain
code that reads a command-line argument for the number of records to read, and
a second argument for the file specification. Your program execution command
could look like the following:
% myprog 1028 powers.dat
In the preceding example the program
myprog
would read 1028 records from the
file powers.dat.
Multiple command-line arguments are delimited by spaces, as shown in the
preceding example. If an argument itself contains spaces, enclose that argument
in quotation marks (" ") as follows:
% myprog2 "all of this is argument 1" argument2
Developing Compaq COBOL Programs 1–23