Page 1 of 1
Description of SQL error.
Posted: Wed Apr 05, 2017 2:31 pm
by Bethany
Hi,
If any SQL error occured during run of any batch program, where can we check complete message for that SQL code. What I am asking is that is there a place in logs where it will give position of column where problem is, is there any variable which stores such message?
Re: Description of SQL error.
Posted: Wed Apr 05, 2017 4:58 pm
by Anuj Dhawan
Unless 'am mistaken you are looking for DSNTIAR. DSNTIAR is an assembler subroutine and helps you to obtain a formatted form of the SQLCA and a text message that is based on the SQLCODE field of the SQLCA. Said that, I've presumed you are using SQLCA in your COBOL-DB2 code. A typical output from DSNTIAR will look like this:
Code: Select all
DSNT408I SQLCODE = -501, ERROR: THE CURSOR IDENTIFIED IN A FETCH OR
CLOSE STATEMENT IS NOT OPEN
DSNT418I SQLSTATE = 24501 SQLSTATE RETURN CODE
DSNT415I SQLERRP = DSNXERT SQL PROCEDURE DETECTING ERROR
DSNT416I SQLERRD = -315 0 0 -1 0 0 SQL DIAGNOSTIC INFORMATION
DSNT416I SQLERRD = X'FFFFFEC5' X'00000000' X'00000000'
X'FFFFFFFF' X'00000000' X'00000000' SQL DIAGNOSTIC
INFORMATION
Hope this helps.
Re: Description of SQL error.
Posted: Thu Apr 06, 2017 10:30 pm
by Bethany
Thanks Anuj. Can you please help with some good example of it which I can use as a reference please?
Re: Description of SQL error.
Posted: Thu Apr 06, 2017 10:39 pm
by Anuj Dhawan
A google search could have also helped you:
A scenario for using DSNTIAR.
Re: Description of SQL error.
Posted: Fri Apr 07, 2017 11:54 am
by Bethany
Thank you so much Anuj.
Google helps more the experinced people like you