SQL/MP Programming Manual for COBOL85
Error and Status Reporting
HP NonStop SQL/MP Programming Manual for COBOL85—429326-004
9-21
Returning Performance and Statistics Information
The SQLSA structure is undefined after the execution of a DSL, DDL, DCL, or
transaction control statement.
Use this syntax for the INCLUDE SQLSA directive to declare the SQLSA in the Data
Division of your program (but not in a Declare Section):
Follow these guidelines when you declare and use an SQLSA structure:
•
You might need to specify an INCLUDE STRUCTURES directive with the version
of the SQLSA structure you require. If you do not first specify this directive,
SQL/MP generates version 2 SQL structures by default.
•
Use the SQLSADISPLAY system procedure to write information from the SQLSA
structure to a file or terminal. For information about SQL system procedures, see
Section 5, SQL/MP System Procedures.
•
A new statement resets the SQLSA structure fields. If you are using a value
elsewhere in your program, you might need to save the value immediately after the
statement executes (or declare more than one SQLSA structure).
•
Each FETCH statement resets the SQLSA structure. To calculate statistics for a
cursor, declare accumulator variables for the required statistics. Then add values
from the SQLSA fields to the accumulator variables after each FETCH operation.
Example 9-3 on page 9-22 shows an SQLSA structure generated in a COBOL program
by the INCLUDE SQLSA directive. (For the version 1 and version 2 SQLSA structures,
see Appendix D, Converting COBOL Programs.)
EXEC SQL INCLUDE SQLSA END-EXEC.