By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,017 Members | 979 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,017 IT Pros & Developers. It's quick & easy.

Automated db2 commands in a shell script

P: 13
Hello,

I posted this problem already in the linux section but without positive result. Perhaps someone here has experienced the smae problem.

I am pretty new with writing shell scripts and trying to use a script to perform some db2 commands on a CentOS 4 system. I get a problem when I put in my shell-file 'myscript.sh' the command:

Expand|Select|Wrap|Line Numbers
  1. db2 -tf somefile.sql
  2.  
When executing, I get a DB2 error:

Expand|Select|Wrap|Line Numbers
  1. DB21004E You cannot specify both an input file and a command when invoking the Command Line Processor.
  2.  
I discovered, using the debug command $ sh -x myscript.sh, that the shell adds some end of line symbols or something that ruin the command, since the output gives:

Expand|Select|Wrap|Line Numbers
  1. + db2 -tf ctb2.sql $'\r'
  2.  
Did anyone face similar problems once and know how to solve it? Thanks in advance, Siebbel.
Mar 29 '07 #1
Share this Question
Share on Google+
1 Reply


P: 6
Hello,

I posted this problem already in the linux section but without positive result. Perhaps someone here has experienced the smae problem.

I am pretty new with writing shell scripts and trying to use a script to perform some db2 commands on a CentOS 4 system. I get a problem when I put in my shell-file 'myscript.sh' the command:

Expand|Select|Wrap|Line Numbers
  1. db2 -tf somefile.sql
  2.  
When executing, I get a DB2 error:

Expand|Select|Wrap|Line Numbers
  1. DB21004E You cannot specify both an input file and a command when invoking the Command Line Processor.
  2.  
I discovered, using the debug command $ sh -x myscript.sh, that the shell adds some end of line symbols or something that ruin the command, since the output gives:

Expand|Select|Wrap|Line Numbers
  1. + db2 -tf ctb2.sql $'\r'
  2.  
Did anyone face similar problems once and know how to solve it? Thanks in advance, Siebbel.
Try
Expand|Select|Wrap|Line Numbers
  1. db2 -tvf somefile.sql
Apr 2 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.