Hi,
When I use the below script, I can pass the job parameter value successfully, but I'm getting the extra parameter value. In file I have 8 job names but I'm getting 9 and the extra one is the actual parameter that is passing to the script . While executing I'm passing dscompilebatch2.bat o9999 CPT_REB and I'm getting all the 8 job names from the file and passed to j parameter+ CPT_REB parameter value to j parameter which I don't want. I want the parameter values only from the file and not any additional parameters like positional parameter value to be passed.
REM ==========Written by Somaraju Buddharaju==================================================
@Echo off
REM ========= Pass Datastage userid, password and Datastage project name ======================
REM ========= as command line input parameters to the script =================================
SET DSCompileCMD="C:\IBM\InformationServer\Clients\Classic\dscc.exe"
echo a=%DSCompileCMD%
echo type the password:
set /p password=
set userid=%1
echo %userid%
set project=%2
echo %project%
@echo off
REM ====== OPEN THE FILE AND READ THE DATASTAGE JOBS THAT NEEDS TO BE COMPILE
for /f "tokens=*" %%a in (H:\Data\Dir\ECI_Return_File_Names.txt) do call :processline %%a
:processline
REM ==== FIND THE NUMBER OF LINES IN THE FILE_NAMES file
SET Lines=0
for /f %%a in (H:\Data\Dir\ECI_Return_File_Names.txt) do (set /a Lines+=1)
echo The file has %Lines% lines
SET DParams= /d INFETLD01:9080 /h INFETLD01 /u %userid% /p %password% /j %* %project%
REM ===============
echo b=%DParams%
echo %* >> H:\Data\Dir\log3.txt
REM ================================
REM ===== %DSCompileCMD% %DParams% >> H:\Data\Dir\log1.txt
goto :eof
:eof
How to eliminate the extra parameter value to the bat
Moderator: DosItHelp
Re: How to eliminate the extra parameter value to the bat
Try it with these changes.
somu_june wrote:REM ====== OPEN THE FILE AND READ THE DATASTAGE JOBS THAT NEEDS TO BE COMPILE
for /f "tokens=*" %%a in (H:\Data\Dir\ECI_Return_File_Names.txt) do call :processline %%a
goto :eof <--- add this here
:processline
:eof <--- remove this from the bottom of the script. It is not needed.
Re: How to eliminate the extra parameter value to the bat
Thank you so much.... I tried in different forums but not successfull, you rock and its working like a charm