SQL/MP Programming Manual for COBOL

HP NonStop SQL/MP Programming Manual for COBOL529758-003
8-1
8
Program Invalidation and Automatic
SQL Recompilation
This section describes the causes of program invalidation and automatic SQL
recompilation and preventive steps you can take in either case.
Program Invalidation
An SQL program file can be valid or invalid. A valid program can run without SQL
recompilation using its current execution plans. An invalid program is subject to SQL
recompilation (depending on options such as the similarity check) because of changes
either to the program file itself or to an SQL object it references. An SQL program file
has these classifications of SQL validity:
The SQL SENSITIVE flag in the program’s file label indicates the file is an SQL
program that has been SQL compiled (although it might be invalid). The
SENSITIVE flag also protects the program file from access by Enscribe utilities.
The VALID flag in the program’s file label and in the PROGRAMS catalog table
indicates whether the program file can run without SQL recompilation.
SQL Compiler Validation Functions
The SQL compiler validates an SQL program file after a successful explicit SQL
compilation or after errors occurred during a compilation with the FORCE option
specified. During explicit compilation, the SQL compiler performs these functions
related to program validation:
Sets the VALID and SENSITIVE flags in the program’s file label
Records the timestamp of the SQL compilation in the program’s file label
Registers the program and sets the VALID flag in the PROGRAMS table
Creates entries in the USAGES table for any SQL objects (tables, views, indexes,
or collations) required by the program’s execution plans
For a list of all SQL compiler functions, see Section 6, Explicit Program Compilation.
To determine if an SQL program is valid, use the SQLCI VERIFY utility or the SQLCI
(or FUP) FILEINFO command with the DETAIL option. From a program, call the
FILE_GETINFOLIST_ or FILE_GETINFOLISTBYNAME_ system procedure and
specify item codes 82 and 83. Item code 82 indicates whether the file is an SQL
program (1=SQL program, 0=other), and item code 83 indicates whether the program
file is valid (1=valid, 0=invalid).