Administrative API Reference

sqlaintp - Get Error Message

Retrieves the message associated with an error condition specified by the sqlcode field of the sqlca structure.

Authorization

None

Required Connection

None

Version

sql.h

C API Syntax



/* File: sql.h */
/* API: Get Error Message */
/* ... */
SQL_API_RC SQL_API_FN
  sqlaintp (
    char * pBuffer,
    short BufferSize,
    short LineWidth,
    struct sqlca * pSqlca);
/* ... */
 

Generic API Syntax



/* File: sql.h */
/* API: Get Error Message */
/* ... */
SQL_API_RC SQL_API_FN
  sqlgintp (
    short BufferSize,
    short LineWidth,
    struct sqlca * pSqlca,
    _SQLOLDCHAR * 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.

pSqlca
Output. A pointer to the sqlca structure. For more information about this structure, see SQLCA.

pBuffer
Output. A pointer to a string buffer where the message text is 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 INTO :msg [LINEWIDTH width]

REXX API Parameters

msg
REXX variable into which the text message is placed.

width
Maximum line width for each line in the text message. The line is broken on word boundaries. If width is not given or set to 0, the message text returns without line breaks.

Sample Programs

C
\sqllib\samples\c\utilapi.c

COBOL
\sqllib\samples\cobol\checkerr.cbl

REXX
\sqllib\samples\rexx\dbcat.cmd

Usage Notes

One message is returned per call.

A new line (line feed, LF, or carriage return/line feed, CR/LF) sequence is placed at the end of each message.

If a positive line width is specified, new line 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 new line 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
No error. The sqlca did not contain an error code (SQLCODE = 0).

-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 additional information about the problem.

See Also

sqlogstt - Get SQLSTATE Message.


[ Top of Page | Previous Page | Next Page ]