COBOL Manual for TNS and TNS/R Programs

Creating and Compiling HP COBOL Source
Programs
HP COBOL Manual for TNS and TNS/R Programs522555-006
22-19
Specifying Subvolumes to Be Searched for
Unqualified Files
Directive for Specifying the Program’s Run-Time
Environment
For TNS programs in the Guardian environment, you have a choice of run-time
environments: the non-CRE environment or the CRE. The CRE is recommended for
mixed-language programs, because it puts fewer restrictions on them and they execute
more efficiently (see Run-Time Environment).
By default, the COBOL85 compiler produces object code that executes in the non-CRE
environment. To make the COBOL85 compiler produce object code that executes in
the CRE, use the compiler directive ENV with the option COMMON, like this:
90> COBOL85 /IN XYZ, OUT $SPX/ XYZOBJ, COPLIB2; ENV COMMON
Specifying Subvolumes to Be Searched for Unqualified Files
In your HP COBOL source program, an unqualified file is a file whose name does not
contain a volume and subvolume. It can be a source file (as in a COPY statement) or
an object file (as in an ENTER statement).
Two DEFINEs allow you to specify one or more subvolumes for the compiler to search
for unqualified files:
=_SOURCE_SEARCH (for unqualified source files)
=_OBJECT_SEARCH (for unqualified object files)
These DEFINEs have CLASS attribute SEARCH. Use them by entering ADD DEFINE
commands before compiling your program, as in this example. (An ampersand at the
end of a line means that the TACL command continues on the next line.)
91> ADD DEFINE =_SOURCE_SEARCH, CLASS SEARCH, SUBVOL0&
91> (=_DEFAULTS,$VOL1.SUB2,$VOL1.SUB3)
92> ADD DEFINE =_OBJECT_SEARCH, CLASS SEARCH, SUBVOL0&
92> (=_DEFAULTS,$VOL2.SUB1,$VOL2.SUB2)
93> COBOL85 /IN XYZ, OUT $SPX/ XYZOBJ
93> NMCOBOL /IN XYZ, OUT $SPX/ XYZOBJ
In the preceding example, the compiler will search for unqualified source files on the
default subvolume first, then on $VOL1.SUB2, and finally on $VOL1.SUB3. The
compiler will search for unqualified object files on the default subvolume first, then on
$VOL2.SUB1, and finally on $VOL2.SUB2.
Suppose that you want to add the subvolume $VOL3.SUB1 to the
_SOURCE_SEARCH list. Use an ADD DEFINE command whose SUBVOLn
parameter has n greater than 0 (the value of n in the preceding example):
94> ADD DEFINE =_SOURCE_SEARCH, CLASS SEARCH, SUBVOL1&
94> ($VOL3.SUB1)
Now the compiler will search for unqualified source files on these subvolumes in this
order: default subvolume, $VOL1.SUB2, $VOL1.SUB3, $VOL3.SUB1.
Note. This topic applies only to TNS programs. Native programs always run in the CRE.