The problem is the variable ORIG_FILENAME keeps its old value and won't be updated. The value should come out of a file which with be read using the FOR command.
This is the code:
Code: Select all
echo START FINDSTR
findstr /m "%%b" C:\Temp\gasdats\*.* > tmp_filename.txt && (
echo "%%ORIGFILE_NAME%% (for)" %ORIG_FILENAME%
for /f "tokens=4-13 delims=\_" %%k in (tmp_filename.txt) do set ORIG_FILENAME=%%k_%%l_%%m_%%n_%%o__%%p_%%q_%%r_%%s
echo "%%ORIGFILE_NAME%% (after)" %ORIG_FILENAME%
echo ^<td^>%ORIG_FILENAME%^</td^> >> report_gasdats_%UNIQUE%.html
echo ^<td^> >> report_gasdats_%UNIQUE%.html
echo "DO SQLQUERY WITH %%ORIG_FILENAME%%" %ORIG_FILENAME%
sqlplus -s /nolog @query2.sql %ORIG_FILENAME% >> report_gasdats_%UNIQUE%.html
echo ^</td^> >> report_gasdats_%UNIQUE%.html
) || (
echo ^<td^>NEE^</td^>^<td^>-^</td^> >> report_gasdats_%UNIQUE%.html
echo ^<td^>-^</td^>
)
echo EIND FINDSTR
And in the logging where we can see the variable ORIG_FILENAME keeps its old value CATS_RECVD_2008_07_29__14_43_01_667.dat.cmpr.DA. The logging says the SET command has updated ORIG_FILENAME to CATS_RECVD_2008_07_29__15_02_26_621.dat.
Code: Select all
START FINDSTR
"%ORIGFILE_NAME% (for)" CATS_RECVD_2008_07_29__14_43_01_667.dat.cmpr.DA
C:\Temp>set ORIG_FILENAME=CATS_RECVD_2008_07_29__15_02_26_621.dat
"%ORIGFILE_NAME% (after)" CATS_RECVD_2008_07_29__14_43_01_667.dat.cmpr.DA
"DO SQLQUERY WITH %ORIG_FILENAME%" CATS_RECVD_2008_07_29__14_43_01_667.dat.cmpr.DA
EIND FINDSTR
Can somebody help me with this?