MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

how to use SQLSTATE in COBOL code

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
pzmohanty
Beginner


Joined: 20 May 2004
Posts: 97
Topics: 43
Location: hyderabad, India

PostPosted: Mon Oct 04, 2004 11:16 pm    Post subject: how to use SQLSTATE in COBOL code Reply with quote

hi all,

to check the status of previosly executed sql statement we use SQLCODE in our COBOL code & check whether SQLCODE is equal to zero , greater than zero or less than zero & accordingly interpret the status of previously executed SQL statement.

In the same vien how should we use SQLSTATE in our COBOL program .

a sample COBOL code using SQLSTATE will be of immense help.

Thanx in advance
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12380
Topics: 75
Location: San Jose

PostPosted: Tue Oct 05, 2004 4:28 am    Post subject: Reply with quote

pzmohanty,

An SQLSTATE variable declared as PICTURE X(5) .

You can simply code
Code:

 IF SQLSTATE = '00000'
   DISPLAY 'SUCCESSFUL EXCUETION'
 END-IF

Check this link for the possible values of SQLSTATE.

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/DSNMCH11/APPENDIX1.3.1?SHELF=&DT=20010718150520&CASE=

Why do you even want to use SQLSTATE? Can't you use DSNTIAR for error checking? DSNTIAR returns translates SQLCA into Messages.

Look up the DB2 Application programming guide for more information on DSNTIAR

Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group