These variables receive the return status values of stored procedures. Status variables indicate whether the stored procedure completed successfully or the reasons it failed. You must use a variable that can be converted from the Adaptive Server type to smallint.
The following example uses the RET-CODE variable as a status variable:
exec sql begin declare section end-exec
01 RET-CODE PIC S9(4) COMP.
exec sql end declare section end-exec.
. . .
exec sql exec :RET-CODE = update_pubs end-exec.
IF RET-CODE NOT = 0
exec sql rollback transaction end-exec.