If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Errorlevel in DOS Batch

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-16-06, 10:45
tmoeller tmoeller is offline
Registered User
 
Join Date: Apr 2003
Posts: 30
Errorlevel in DOS Batch

Hi,

i have a DOS .cmd file with calling the db2 command window like this:

"db2cmd -c -i -w db2 connect to test user will using smith"

I thought a fail of this connect would return me some errorlevel being not 0, which i can react on.

But, this doesn't happen. It is always 0.

Does anybody know How to catch an error in this scenario????

Thanks
Reply With Quote
  #2 (permalink)  
Old 01-16-06, 15:01
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
You should be checking the exit code after db2, not after db2cmd.

By the way, the command you've shown doesn't make much sense: once db2cmd returns the connection will be terminated.
Reply With Quote
  #3 (permalink)  
Old 01-17-06, 07:06
sun4u sun4u is offline
Registered User
 
Join Date: Dec 2005
Posts: 18
what is your client version, my works fine with 8.1 fixpack 10

db2cmd does return errorlevel.
Reply With Quote
  #4 (permalink)  
Old 01-19-06, 07:21
tmoeller tmoeller is offline
Registered User
 
Join Date: Apr 2003
Posts: 30
The statement was just a quick hack. Normaly we call a script making some loads from a scheduler system. We found out the, by mistake an very old rt-client was installed. we corrected that and now this errorlevel thing works fine.

Thanks for the comments.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On