Printing error messages
The following code formats and prints SQL error messages to the SYSTSPRT data set when the product is running in batch mode or TSO:
rc = pssrxsql('select current_timestamp into :TS from sysibm.sysdummy1')
if rc <> 0 then do
msg = 'BMC184001S-PSSREXIT rc=' || rc || '/n'
if sqlcode <> 0 then do i = 1 to 1000 by 80
m = substr(sqlerrm,i+1,79)
if m = ' ' then leave
msg = msg || 'BMC184001S-' || m || '/n'
end
rc = sets('OUT', msg)
end
Important
We do not recommend using the SAY command instead of the STEPS function because the DBC does not allocate a SYSTSPRT data set.
You can use the REXX variable SQLSTATE instead of SQLCODE. SQLSTATE indicates both warnings and errors.
If the product issues a warning without an error, PSSRXSQL returns rc=0, SQLCODE=0, ignoring warnings so that all the row values are returned. If you want to inspect warnings, use the SQLSTATE variable.
Related topic
Was this page helpful? Yes No
Submitting...
Thank you
Comments
Log in or register to comment.