We use fields of SQLCA to enquire about the status of the most recently executed SQL query. The SQLCODE is one such field which can take the various values and each value indicates specific error code. For example, -180 error code represents incorrect timestamp format. However, in the logs we only get the error code and every time we have to refer to the IBM documentation to check the description of the error code.
To overcome this problem, we use DSNTIAR. The DSNTIAR is an inbuilt utility which is provided by IBM to be used in a COBOL-DB2 program.This utility displays the error code and its description in the logs in a well formatted manner, which saves time. The DSNTIAR utility can be called using SQLCA as below.
CALL ‘DSNTIAR’ USING SQLCA, ERROR-MESSAGE
The DSNTIAR utility populates the error description in the ERROR-MESSAGE variable.