Open System Services Shell and Utilities Reference Manual (G06.27+, H06.04+)

cobol(1) OSS Shell and Utilities Reference Manual
If a valid lename cannot be generated using the rule above, a lename returned from
tmpnam is used, and a message informs the user of the new lename.
Libraries residing in Guardian directories cannot be specied as -l operands because of the nam-
ing convention. They can be specied in the desired order with -Wbind ags.
The default executable le in a Guardian le system is aout in the directory from which cobol is
invoked.
Differences Between Static and Dynamic Binding
In static binding, the Binder resolves references to library functions by binding into the program
the functions from a user library, such as libc.a. In dynamic binding, the Binder resolves refer-
ences to library functions by using information found in a shared runtime library, such as libc.so.
Final resolution of references are not done until run time. Dynamic binding produces smaller
program les and uses fewer system resources than static binding. By default, cobol performs
dynamic binding.
A shared library must have a le extension of .so. Such a le can either be an actual shared
library le created by the Binder or an OSS text le containing only one line of text in the form
"SRL=srlpath" where srlpath is the OSS pathname of the actual shared library le.
In dynamic binding, if a library is specied by an operand of the form llibrary, cobol searches for
a le liblibrary.so in a directory in the library search paths. If the le is found in the directory,
cobol issues the Binder command SET IMPORT LIBRARY srlpath, where srlpath is the path-
name of the actual shared library le. If the le is not found in the directory, cobol searches for a
le liblibrary.a in the same directory. If a le is found, cobol issues the Binder command
SELECT SEARCH libpath to perform a static binding of the library. If neither le is found, cobol
repeats the search for the library in the next directory in the library search paths.
In static binding, cobol only searches for liblibrary.a from directories in the library search paths.
Static libraries can be used for dynamic binding. The Binder resolves external references using
all the specied static libraries before using the shared runtime library. A program can only have
one shared runtime library. cobol issues warnings if more than one shared runtime library is
specied.
The standard C runtime library, libc.a or libc.so is used in dynamic binding only if no other
shared runtime libraries are used.
By default, the shared runtime library used during binding (the model library) is the shared run-
time library used during execution (the runtime library), unless a different library is specied by
the -Wrunlib ag.
The shared runtime library must be in the Guardian le system name space. If a shared runtime
library is in the OSS le system name space, you must supply a library in the Guardian name
space either using the -Wrunlib ag during program generation or through the LIB option of the
TACL RUN command during program execution.
Refer to the Binder Manual for more details on using shared runtime libraries.
Using the c89 and cobol Utilities
OSS COBOL85 programs can contain COBOL85 modules and C modules. Compile COBOL85
modules using the cobol utility and C modules using the c89 utility. To produce a program con-
taining COBOL85 and C modules, rst compile all the modules written in either COBOL85 or C.
You can also bind these modules together or with other libraries at this time, but do not
accelerate or SQL-compile the modules. After you have compiled all the modules of one
language, compile the modules written in the other language, specifying any necessary binding,
accelerating, or SQL-compiling options.
For example, to produce an executable object le made up of COBOL85 modules cobol1.cbl
and cobol2.cbl and C modules c1.c and c2.c, you can rst run the C compiler using the c89
256 Hewlett-Packard Company 527188-004