SQL Supplement for H-Series RVUs

SQL/MP Programming Manual for COBOL
HP NonStop SQL Supplement for H-Series RVUs529446-005
1-38
Running the SQL Compiler
Running the SQL Compiler
The SQL compiler (SQLCOMP) generates SQL object code in the program file.
SQLCOMP verifies SQL objects used in SQL statements and generates an optimized
execution plan for each SQL statement. Optionally, you can invoke the EXPLAIN utility
during compilation to generate a report on the execution plans for SQL DML
statements and DEFINEs used by the program.
Required Access Authority
To run the SQL compiler for an SQL program file, you must have this access authority:
Read and purge access to the SQL program file
Read and write access to the PROGRAMS, USAGES, and TRANSIDS tables of
the catalog in which the SQL program file is to be registered
Read and write access to the USAGES and TRANSIDS tables of any catalog in
which a table, view, collation, or index that the SQL program file uses is registered
SQL Compiler Functions
Resolves names and expands SQL object names, including DEFINE names, using
the current default volume and the current catalog, and then stores the DEFINE
names in the SQL object file.
Performs type checking for COBOL and SQL data types.
Expands views.
Checks object references in catalogs for SQL object names to verify their
existence and to read their descriptions, and then evaluates the object type and
characteristics for each reference.
Determines an optimized execution plan by analyzing SELECT, INSERT, UPDATE,
and DELETE statements to determine the best access paths and join, sort, and
blocking strategies. Estimates the execution costs for DML statements based on
the statistics in the catalogs.
Generates executable code for the execution plans.
Registers the program in the specified PROGRAMS table and stores any
dependencies for tables, views, collations, and indexes in the USAGES table for
each table, view, or index that is accessed.
Caution. You can use the Accelerator or the OCA to optimize TNS object code running on a
TNS/R or TNS/E system. The Accelerator or OCA, however, invalidates SQL program files.
Therefore, run the Accelerator or OCA before you explicitly SQL compile the program to avoid
having to recompile. For more information, see Acceleration of TNS HP COBOL Programs
on
page 1-36.