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 > Batch file stops execution after the 'db2cmd -i -w db2clpsetcp' is issued.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-14-11, 05:30
$uraJ $uraJ is offline
Registered User
 
Join Date: Oct 2011
Posts: 4
Question 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.
Reply With Quote
  #2 (permalink)  
Old 10-14-11, 09:45
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
Try it without the -w option which creates a new DB2 window.

Andy
Reply With Quote
  #3 (permalink)  
Old 10-14-11, 10:58
$uraJ $uraJ is offline
Registered User
 
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
Reply With Quote
  #4 (permalink)  
Old 10-14-11, 11:56
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
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
Reply With Quote
  #5 (permalink)  
Old 10-17-11, 08:21
$uraJ $uraJ is offline
Registered User
 
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.
Reply With Quote
  #6 (permalink)  
Old 10-17-11, 08:23
$uraJ $uraJ is offline
Registered User
 
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.
Reply With Quote
Reply

Tags
clp environment, db2, db2 command

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