For Loop Variable issue
Posted: 27 Aug 2014 04:24
Hi
I am facing an issue after executing the thirdparty command(which datastage "IStool") in For Loop which is not assigning the second value to variable.
Below is the script i am executing:
Log File says:
When i comment the line
it passes the values to variable as expected:
Thanks
Naga
I am facing an issue after executing the thirdparty command(which datastage "IStool") in For Loop which is not assigning the second value to variable.
Below is the script i am executing:
Code: Select all
@SET
SETLOCAL EnableDelayedExpansion
REM ############### Assigning the Directories to Variables######################
SET "DSHOME_PATH=E:\IBM\InformationServer\"
SET "HOME_PATH=E:\Temp\"
SET "DSBIN_PATH=%DSHOME_PATH%Server\DSEngine\bin\"
SET "DSISTOOL_PATH=%DSHOME_PATH%Clients\istools\cli\"
SET "BACKUP_PATH=%HOME_PATH%"
SET "SCRIPT_PATH=%HOME_PATH"
SET "TEMP_PATH=%HOME_PATH%"
SET "LOG_PATH= %HOME_PATH%"
REM ################ Creating Log File Name #######################################
SET DDATE=%date:~10%%date:~4,2%%date:~7,2%
SET DTIME=%time: =0%
SET DTIME=%DTIME:~0,2%%DTIME:~3,2%%DTIME:~6,2%
SET LOGFNAME=%LOG_PATH%%~n0_%DDATE%_%DTIME%.log
SET PROJECTLIST=%TEMP_PATH%PROJECTLIST.txt
ECHO. >%LOGFNAME%
copy nul %LOGFNAME%
REM ############### Exporting the Datastage Projects to Backup File ########################################
FOR /F "tokens=1" %%I IN (%PROJECTLIST%) DO (
SET PROJECTNAME=%%I
ECHO %date:~4% %time% Exporting the Datastage Project: !PROJECTNAME! >> %LOGFNAME%
SET DDATE=%date:~10%%date:~4,2%%date:~7,2%
SET DTIME=%time: =0%
SET DTIME=%DTIME:~0,2%%DTIME:~3,2%%DTIME:~6,2%
SET EXPORTFILENAME=%BACKUP_PATH%!PROJECTNAME!_%DDATE%_%DTIME%.isx
ECHO Export File Name !EXPORTFILENAME! >> %LOGFNAME%
%DSISTOOL_PATH%istool export -dom USAWS09WVDBS002 -u ChalamN -p Tuesday38$ -datastage USAWS09WVDBS002/!PROJECTNAME!/*/*.* -archive !EXPORTFILENAME!
)
Log File says:
08/27/2014 10:24:51.41 Exporting the Datastage Project: dstage1
Export File Name E:\Temp\dstage1_20140827_102451.isx
08/27/2014 10:24:51.41 Exporting the Datastage Project: !PROJECTNAME!
Export File Name !EXPORTFILENAME!
When i comment the line
Code: Select all
%DSISTOOL_PATH%istool export -dom USAWS09WVDBS002 -u ChalamN -p Tuesday38$ -datastage USAWS09WVDBS002/!PROJECTNAME!/*/*.* -archive !EXPORTFILENAME!
it passes the values to variable as expected:
08/27/2014 10:09:51.75 Exporting the Datastage Project: dstage1
Export File Name E:\Temp\dstage1_20140827_100951.isx
08/27/2014 10:09:51.75 Exporting the Datastage Project: Test
Export File Name E:\Temp\Test_20140827_100951.isx
Thanks
Naga