The SQLERRM data area is used to pass error messages to the application from the database server. The SQLERRM data area is split into two parts:
Within an error routine, the following code can be used to display the SQL error message:
if (SQLERRML > ZERO) and (SQLERRML < 80) display 'Error Message: ', SQLERRMC(1:SQLERRML) else display 'Error Message: ', SQLERRMC end-if.