SQL Supplement for H-Series RVUs

SQL/MP Programming Manual for COBOL
HP NonStop SQL Supplement for H-Series RVUs529446-005
1-16
Preparing for Compilation
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 on page 1-16
Using DEFINEs in the OSS Environment on page 1-17
Using DEFINEs in the Guardian Environment
Use a class CATALOG DEFINE for a catalog and a class MAP DEFINE for an object,
as follows:
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
22> ADD DEFINE =collate1, CLASS MAP, FILE collate1
...
If you specify a DEFINE name in an SQL statement that is not in your current set
of DEFINEs, the SQL compiler issues a warning message and leaves the
statement uncompiled in the object file. When you run your program, the SQL
executor automatically tries to recompile the SQL statement. If the DEFINE is still
not available at run time, the SQL compiler issues an error message.
Note. For information about adding DEFINEs in an OSS environment, see Using
DEFINEs in the OSS Environment on page 1-17.