API Reference
Retrieves the message text associated with an SQLSTATE.
Authorization
None
Required Connection
None
API Include File
sql.h
C API Syntax
/* File: sql.h */
/* API: Get SQLSTATE Message */
/* ... */
SQL_API_RC SQL_API_FN
sqlogstt (
char * pBuffer,
short BufferSize,
short LineWidth,
char * pSqlstate);
/* ... */
|
Generic API Syntax
/* File: sql.h */
/* API: Get SQLSTATE Message */
/* ... */
SQL_API_RC SQL_API_FN
sqlggstt (
short BufferSize,
short LineWidth,
char * pSqlstate,
char * pBuffer);
/* ... */
|
API Parameters
- BufferSize
- Input. Size, in bytes, of a string buffer to hold the retrieved message
text.
- LineWidth
- Input. The maximum line width for each line of message text. Lines are
broken on word boundaries. A value of zero indicates that the message text is
returned without line breaks.
- pSqlstate
- Input. A string containing the SQLSTATE for which the message text is to
be retrieved. This field is alphanumeric and must be either five-digit
(specific SQLSTATE) or two-digit (SQLSTATE class, first two digits of an
SQLSTATE). This field does not need to be NULL-terminated if 5 digits are
being passed in, but must be NULL-terminated if 2 digits are being passed.
- pBuffer
- Output. A pointer to a string buffer where the message text is to be
placed. If the message must be truncated to fit in the buffer, the truncation
allows for the null string terminator character.
REXX API Syntax
GET MESSAGE FOR SQLSTATE sqlstate INTO :msg [LINEWIDTH width]
|
REXX API Parameters
- sqlstate
- The SQLSTATE for which the message text is to be retrieved.
- msg
- REXX variable into which the message is placed.
- width
- Maximum line width for each line of the message text. The line is broken
on word boundaries. If a value is not specified, or this parameter is set to
0, the message text returns without line breaks.
Sample Programs
- COBOL
- \sqllib\samples\cobol\checkerr.cbl
- FORTRAN
- \sqllib\samples\fortran\util.f
Usage Notes
One message is returned per call.
A LF/NULL sequence is placed at the end of each message.
If a positive line width is specified, LF/NULL sequences are inserted
between words so that the lines do not exceed the line width.
If a word is longer than a line width, the line is filled with as many
characters as will fit, a LF/NULL is inserted, and the remaining
characters are placed on the next line.
Return Codes
- Code
- Message
- +i
- Positive integer indicating the number of bytes in the formatted message.
If this is greater than the buffer size input by the caller, the message is
truncated.
- -1
- Insufficient memory available for message formatting services to function.
The requested message is not returned.
- -2
- The SQLSTATE is in the wrong format. It must be alphanumeric and be either
2 or 5 digits in length.
- -3
- Message file inaccessible or incorrect.
- -4
- Line width is less than zero.
- -5
- Invalid sqlca, bad buffer address, or bad buffer length.
If the return code is -1 or -3, the message buffer will contain further
information about the problem.
See Also
sqlaintp - Get Error Message.
[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]
[ DB2 List of Books |
Search the DB2 Books ]