SQL/MP Programming Manual for COBOL

SQL/MP System Procedures
HP NonStop SQL/MP Programming Manual for COBOL529758-003
5-16
Additional Considerations for SQLCA_BUFFER2_
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_DISPLAY2_ 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_BUFFER2_
Additional considerations for the SQLCA_BUFFER2_ procedure are:
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.
SQLCA_TOBUFFER2_ works by starting with the first-record-number
indicated to move output lines to the record area until all error messages are
moved or until the text fills the record area. SQLCA_TOBUFFER2_ returns to
output-records a count of the lines moved to the buffer. If overflow occurs, the
procedure sets the more flag to Y.
On an overflow condition, the program can retrieve the remainder of the error
message text by calling SQLCA_TOBUFFER2_ again, setting
first-record-number to output-records + 1.
This example uses a 75-character output record and declares a buffer
SQLMSG-BUFFER as 375 characters. The ENTER statement specifies the SQLMSG
file number with data item SQLMSG-FILENUM set to -1. The statement returns the file
number so that subsequent calls retain the number.
WORKING-STORAGE SECTION.
01 SQLMSG-BUFFER PIC X(375).
01 SQLMSG-FILENUM PIC S9(4) COMP VALUE -1.
PROCEDURE DIVISION.
...
ENTER TAL "SQLCA_TOBUFFER2_" USING
SQLCA,