Results 1 to 6 of 6
  1. #1
    Join Date
    Oct 2011
    Posts
    4

    Question Unanswered: Batch file stops execution after the 'db2cmd -i -w db2clpsetcp' is issued.

    I am facing issues when running the set environments command followed by the db2 commands in the batch file.

    The batch file looks like this:
    --------------
    db2cmd -i -w db2clpsetcp
    db2 CREATE DATABASE dbname
    db2 -tvf db2look.sql
    db2move dbname load
    db2 connect to dbname user username using password
    db2 set integrity for dbname.tablename1 immediate checked
    pause;
    --------------

    Issue:
    upon running the batch file, line 1 executes and the cmd window refreshes to set environment (kind of clear screen).
    But the line#2 and onwards does not execute.
    If i type 'exit' the environment is exited and the rest part of batch executes, with environment not set error.

  2. #2
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    Try it without the -w option which creates a new DB2 window.

    Andy

  3. #3
    Join Date
    Oct 2011
    Posts
    4
    I referred the below link and it says -w is used for waiting until prev command finished execution,

    DB2 Universal Database

    However, I tried the suggestion and had a hard luck

    also, i am not facing a new window launch issue, an effect like cls takes place,

    being rookie is sad

  4. #4
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    The db2cmd is creating a new window. Try it like this:

    Code:
    db2clpsetcp
    db2 CREATE DATABASE dbname
    db2 -tvf db2look.sql
    db2move dbname load
    db2 connect to dbname user username using password
    db2 set integrity for dbname.tablename1 immediate checked
    pause;
    Andy

  5. #5
    Join Date
    Oct 2011
    Posts
    4
    I tried the above suggestion, now the first line doesnt seem to set the environments. I get the environments not set error.

  6. #6
    Join Date
    Oct 2011
    Posts
    4
    However, i currently have a workaround for this, I support the script with a readme stating the user to open the cmd and type this (db2cmd -i -w db2clpsetcp) command , once the environments are set, i ask to run the script.

Tags for this Thread

Posting Permissions

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