SQL Programming Manual for TAL
Error and Status Processing
HP NonStop SQL Programming Manual for TAL—527887-001
6-9
Getting Information From the SQLCA
Getting Information From the SQLCA
NonStop SQL returns run-time information, including errors and warnings, for the most
recently executed SQL statement to the SQL communication area (SQLCA). The
SQLCA is the primary status checking area for application programs because it
contains more detailed information than the SQLCODE variable. The compiler
initializes the SQLCA before each executable SQL statement.
Declaring the SQLCA Structure
Use the INCLUDE SQLCA directive to declare the SQLCA in the variable declarations
part of your TAL program. If the SQLCA must always be accessible to all parts of your
program, include the INCLUDE SQLCA directive with your global variable declarations.
The syntax is:
An example of the INCLUDE SQLCA directive is:
! Global declarations:
EXEC SQL
INCLUDE SQLCA;
...
Using System Procedures With the SQLCA Structure
Table 6-2 shows SQL system procedures you can use to retrieve and display
information from the SQLCA structure.
To include declarations for these procedures in your program, use the SOURCE
directive for the EXTDECS file.
Figure 6-4
shows an example that calls the SQLCADISPLAY procedure.
INCLUDE SQLCA
Table 6-2. System Procedures for the SQLCA Structure
System Procedure Description
SQLCADISPLAY Writes to a file or to a terminal the error or warning messages
returned to the program by SQL
SQLCAGETINFOLIST Writes to a record area in the program a subset (which you
specify) of the error or warning information in the SQLCA
SQLCATOBUFFER Writes to a record area in the program the error or warning
messages returned to the program by SQL
SQLCAFSCODE Returns information about file-system, disk-process, or NonStop
Kernel operating system errors