Code: Select all
Set TODAYSDATE=%date:~4,2%%date:~7,2%%date:~10,4%
echo on
SET REPDATE=%TODAYSDATE%
Set CURYEAR=%date:~10,4%
for /f "tokens=1-4 delims=/- " %%a in ('date /t') do set month_num=%%b
if %month_num% == 01 set qrtr_var=Q1
if %month_num% == 02 set qrtr_var=Q1
if %month_num% == 03 set qrtr_var=Q1
if %month_num% == 04 set qrtr_var=Q2
if %month_num% == 05 set qrtr_var=Q2
if %month_num% == 06 set qrtr_var=Q2
if %month_num% == 07 set qrtr_var=Q3
if %month_num% == 08 set qrtr_var=Q3
if %month_num% == 09 set qrtr_var=Q3
if %month_num% == 10 set qrtr_var=Q4
if %month_num% == 11 set qrtr_var=Q4
if %month_num% == 12 set qrtr_var=Q4
if %month_num% == 01 set G=JAN
if %month_num% == 02 set G=FEB
if %month_num% == 03 set G=MAR
if %month_num% == 04 set G=APR
if %month_num% == 05 set G=MAY
if %month_num% == 06 set G=JUN
if %month_num% == 07 set G=JUL
if %month_num% == 08 set G=AUG
if %month_num% == 09 set G=SEP
if %month_num% == 10 set G=OCT
if %month_num% == 11 set G=NOV
if %month_num% == 12 set G=DEC
SET "LIST=JAN,JUL"
SET "LIST2=JAN,MAY,JUL,OCT"
FOR %%A IN (%LIST%) DO (IF "%G%"=="%%A" (CALL :COND1) ELSE CALL :COND3)
FOR %%C IN (%LIST2%) DO (IF "%G%"=="%%C" (CALL :COND2) ELSE CALL :COND3)
EXIT/B
:COND1
@ECHO ON
REM ########### Report name1 #####################################################
sqlplus %username%@dbname/%1 @"clearcase path"
copy C:\Developers\1reportname_%TODAYSDATE%.xls "shared drive link to copy "
REM ########### Report name2 #####################################################
sqlplus %username%@dbname/%1 @"clearcase path"
copy C:\Developers\1reportname_%TODAYSDATE%.xls "shared drive link to copy "
REM ########### Report name2 #####################################################
sqlplus %username%@dbname/%1 @"clearcase path"
copy C:\Developers\1reportname_%TODAYSDATE%.xls "shared drive link to copy "
GOTO :EOF
:COND2
@ECHO ON
REM ########### Report name4 #####################################################
sqlplus %username%@dbname/%1 @"clearcase path"
copy C:\Developers\1reportname_%TODAYSDATE%.xls "shared drive link to copy "
REM ########### Report name5 #####################################################
sqlplus %username%@dbname/%1 @"clearcase path"
copy C:\Developers\1reportname_%TODAYSDATE%.xls "shared drive link to copy "
REM ########### Report name6 #####################################################
sqlplus %username%@dbname/%1 @"clearcase path"
copy C:\Developers\1reportname_%TODAYSDATE%.xls "shared drive link to copy "
ECHO "REPORTS GENERATED AND FILES COPIED TO SHARED DRIVE"
GOTO :EOF
:COND3
GOTO :EOF