Description of SQL error.

RDBMS from IBM.

Topic author
Bethany
Registered Member
Posts: 10
Joined: Sat Dec 28, 2013 2:57 pm
Has thanked: 3 times

Description of SQL error.

Postby Bethany » Wed Apr 05, 2017 2:31 pm

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?



User avatar

Anuj Dhawan
Founder
Posts: 2389
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Has thanked: 151 times
Been thanked: 66 times

Re: Description of SQL error.

Postby Anuj Dhawan » Wed Apr 05, 2017 4:58 pm

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.


Thanks,
Anuj


Topic author
Bethany
Registered Member
Posts: 10
Joined: Sat Dec 28, 2013 2:57 pm
Has thanked: 3 times

Re: Description of SQL error.

Postby Bethany » Thu Apr 06, 2017 10:30 pm

Thanks Anuj. Can you please help with some good example of it which I can use as a reference please?



User avatar

Anuj Dhawan
Founder
Posts: 2389
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Has thanked: 151 times
Been thanked: 66 times

Re: Description of SQL error.

Postby Anuj Dhawan » Thu Apr 06, 2017 10:39 pm

A google search could have also helped you: A scenario for using DSNTIAR.


Thanks,
Anuj


Topic author
Bethany
Registered Member
Posts: 10
Joined: Sat Dec 28, 2013 2:57 pm
Has thanked: 3 times

Re: Description of SQL error.

Postby Bethany » Fri Apr 07, 2017 11:54 am

Thank you so much Anuj.

Google helps more the experinced people like you :)




Return to “IBM DB2.”

Who is online

Users browsing this forum: CommonCrawl [Bot] and 0 guests