Host status variables

These variables receive the return status values of stored procedures. Status variables indicate whether the stored procedure completed successfully or the reasons it failed.

Declare status variables as 2-byte integers (CS_SMALLINT).

The following example uses the variable retcode as a status variable:

exec sql begin declare section;
 CS_SMALLINT  retcode; 
 exec sql end declare section;
  
 exec sql begin transaction;
 exec sql exec :retcode = update_proc;
 if (retcode != 0) 
 { 
     exec sql rollback transaction;
 }