Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DB2OPTIONS -z with space in filename 1

Status
Not open for further replies.

luvcal

Programmer
Aug 10, 2001
54
US
I am setting the DB2 CLP from a windows batch file and am using the TEMP windows environment variable as the filename. All is fine when TEMP has no spaces in the path, but if there are spaces (e.g. C:\program files), it only can see C:\program. All combinations of single and double quotes did not fix this. Any suggestions?
 
Here is a snippet from the file:

rem Set your database name here.
set DB_NAME=my_db

rem Set the file to log output
set LOGFILE_NAME=%TEMP%\%DB_NAME%.log

rem Check the validity of the TEMP environment variable
if "%TEMP%" == "" goto NOTEMP

rem Check if the directory exists
if not exist "%TEMP%".\ goto BADDIR

rem Set the CLP environment to send output to specified logfile
set DB2OPTIONS=-z %LOGFILE_NAME%

db2 terminate
IT FAILS AFTER THIS OPERATION IF TEMP HAS SPACES.

Thanks again!
 
Try this

Rem ** Set Environment Variable **
set TEMP=c:\program files

rem Set your database name here.
set DB_NAME=my_db

rem Set the file to log output
Rem ** Add quotes to logfile name **
set LOGFILE_NAME="%TEMP%\%DB_NAME%.log"

rem Check the validity of the TEMP environment variable
if "%TEMP%" == "" goto NOTEMP

rem Check if the directory exists
if not exist "%TEMP%".\ goto BADDIR

rem Set the CLP environment to send output to specified logfile
Rem ** Don't supply the logfile name in DB2OPTIONS **
set DB2OPTIONS=

Rem ** Supply logfile name on command line **
db2 -z %LOGFILE_NAME% terminate
 
That did it! Thanks alot! (FYI, I gave you a star for the post).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top