SQL/MP Programming Manual for COBOL

Explicit Program Compilation
HP NonStop SQL/MP Programming Manual for COBOL529758-003
6-9
Copying Source Code Into a Compilation Unit
Copying Source Code Into a Compilation Unit
To copy the COBOL source code from a separate file into a compilation unit, use one
of these options:
COBOL SOURCE directive
COBOL COPY statement
You cannot use SQL statements in a file you are copying with the COPY statement.
For information about the COPY statement or SOURCE directive, see the COBOL85
for NonStop Systems Manual.
Setting DEFINEs
You can use DEFINE names in an SQL program to specify the names of SQL catalogs
and objects (tables, views, indexes, partitions, and collations). You must set all
DEFINE names used in SQL statements before SQL load time (the time when an SQL
program executes its first statement) unless your program uses execution-time name
resolution.
Using DEFINEs in the Guardian Environment
Using DEFINEs in the OSS Environment on page 6-10
Using DEFINEs in the Guardian Environment
Use a class CATALOG DEFINE for a catalog and a class MAP DEFINE for an object:
To use DEFINEs, the DEFMODE attribute must be ON for your TACL process. To
determine the DEFMODE setting, enter the SHOW DEFMODE command at the
TACL prompt:
10> SHOW DEFMODE
Defmode OFF
If DEMODE is OFF, enter a SET DEFMODE ON command:
11> SET DEFMODE ON
Before you run the HP COBOL compiler, add the DEFINEs for the names of SQL
objects you use in INVOKE directives.
12> ADD DEFINE =employee, CLASS MAP, FILE persnl.employee
13> ADD DEFINE =emplist, CLASS MAP, FILE persnl.emplist
...
Before you run the SQL compiler (SQLCOMP), add the DEFINEs for the names of
tables, view, indexes, or collations you use in SQL statements.
20> ADD DEFINE =dept, CLASS MAP, FILE persnl.dept
21> ADD DEFINE =xempname, CLASS MAP, FILE persnl.xempname