Description of SQL error.

RDBMS from IBM and IBM's Hierarchical DBMS and Transaction Manager (IMS DC).
Post Reply
Bethany
Registered Member
Posts: 10
Joined: Sat Dec 28, 2013 2:57 pm

Description of SQL error.

Post 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?
User avatar
Anuj Dhawan
Founder
Posts: 2801
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Contact:
India

Re: Description of SQL error.

Post 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.
Thanks,
Anuj

Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
Bethany
Registered Member
Posts: 10
Joined: Sat Dec 28, 2013 2:57 pm

Re: Description of SQL error.

Post by Bethany »

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: 2801
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Contact:
India

Re: Description of SQL error.

Post by Anuj Dhawan »

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

Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
Bethany
Registered Member
Posts: 10
Joined: Sat Dec 28, 2013 2:57 pm

Re: Description of SQL error.

Post by Bethany »

Thank you so much Anuj.

Google helps more the experinced people like you :)
Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Return to “IBM DB2 and IMS DB/DC”