SQL/MP Programming Manual for COBOL

SQL/MP System Procedures
HP NonStop SQL/MP Programming Manual for COBOL529758-003
5-7
Using SQLCA_DISPLAY2_ With an Error Table
suffix optional input
PIC X(length)
is a string to be appended to each output line. The default is a null string.
suffix-length optional input
PIC S9(4) COMP
is the length of the suffix string for each output line. This length must be an
integer value from 1 to 15. If you include suffix, suffix-length is required.
Using SQLCA_DISPLAY2_ With an Error Table
If you plan to write the buffer to an SQL table for subsequent access through SQLCI,
you might want to reduce the number of lines of error information and the amount of
information in each line. To reduce the line length and the number of lines, specify
SQLCA_DISPLAY2_ parameters that suppress the statistics and the internal error
location and change the prefix to a single space.
Making these changes results in two or three lines per error at the most, or a maximum
of 14 to 21 lines for the rare case where seven errors are returned. In most cases,
space for four errors is sufficient. If you set the line length to 80 characters, four errors
require a buffer of 960 characters.
If you use SQLCA_TOBUFFER2_ to write to an SQL error table, make the same
changes to the parameter defaults.
When you create the table to receive the error information, specify the text columns as
multiples of 80 but less than 255 characters each. If you use SQLCI to retrieve error
information from an error table, it displays a maximum of 255 characters per column. If
you put the entire buffer in one column, SQLCI displays only the first 255 characters of
text. To avoid truncation and allow 80-character lines, define text columns of 240 bytes
each. Depending on the size of the buffer, you might need two, three, or four columns
to hold error information.
Additional Considerations for SQLCA_DISPLAY2_
SQL/MP returns errors as negative numbers and warnings as positive numbers.
Therefore, you might need to modify your program accordingly.
If there is no text for an error number, SQL/MP displays:
No error text found.
If you receive this message, the version of the SQL message file might be invalid.
To determine the version of the SQL message file, use the SQLCI ENV command
and check the version specified by MESSAGEFILEVSRN.
If the error text exceeds output-record-length, the output is folded at word
boundaries, which produces subsequent lines indented five spaces.