SQL Programming Manual for TAL
System Procedures
HP NonStop SQL Programming Manual for TAL—527887-001
4-13
SQLCATOBUFFER
In the example below, SQLCAGETINFOLIST returns the:
•
Name of the function containing the SQL statement that produced one or more 
errors or warnings
•
Name length of the function
•
Number of errors or warnings that occurred
To avoid coding the maximum length for the function name (NAME[0:29] in this 
example):
1. Call SQLCAGETINFOLIST passing item code 7 (ERR^WARN.NAMELEN).
2. Call SQLCAGETINFOLIST again passing a buffer of the appropriate size.
! Declare a structure to hold the error information
STRUCT .err^warn;
 BEGIN
 INT namelen;
 INT numerrs;
 STRING name[0:29];
 END;
! Include the SQLCA structure
 EXEC SQL INCLUDE SQLCA;
! Declare a variable to hold the return code for the call
 INT errcode;
! Declare and initialize the itemlist array
INT itemlist[0:2] := [ 7, 3, 8 ];
! 7 code for name length
! 3 code for number of errors/warnings
! 8 code for procedure id
! Call SQLCAGETINFOLIST
 errcode := SQLCAGETINFOLIST (
 sqlca, ! SQLCA structure
 itemlist, ! List of item codes
 3, ! Number of items
 err^warn, ! Result goes here
 $LEN(err^warn), ! Size of result area
 , ! No error index needed
 30 ); ! Truncate names greater
 ! than 30 characters
SQLCATOBUFFER
The SQLCATOBUFFER procedure writes to a buffer the error or warning messages 
that NonStop SQL returns to the application program. The buffer is a record area 
declared in the variable declarations in the TAL program. The messages can be from 
these subsystems or system components:










