Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2003

    Unanswered: Errorlevel in DOS Batch


    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????


  2. #2
    Join Date
    Jun 2003
    Toronto, Canada
    Provided Answers: 1
    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.

  3. #3
    Join Date
    Dec 2005
    what is your client version, my works fine with 8.1 fixpack 10

    db2cmd does return errorlevel.

  4. #4
    Join Date
    Apr 2003
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts