call ..\shared\SetVariables.cmd
@echo off
rem this command will logon to a database based on the AIRGROUP_DEPLOY_TYPE
rem using the userid and password defined in uid and pwd
rem 
rem -----------------------------------------------------------------
rem     Define script variables. 
rem     Path where the SQL script lives
set inpath=%CD%
rem     Name of the script. Script must end with the word Quit to exit the SQLPlus processor
set SQLInput=55_Update_PURGE_MEM_INFO_Part_2.sql
rem     Logfile name will also be the folder name under mileageplan
set logname=55_Update_PURGE_MEM_INFO_Part_2
set uid=%SOLAR_SIEBEL_PURGE_UID%
set upw=%SOLAR_SIEBEL_PURGE_PWD%
rem -----------------------------------------------------------------
rem 
rem Get current date and time and append to logfile name
rem
for /F "tokens=2-4 delims=/ " %%v in ('date /T') do (set cdate=%%x%%v%%w)
for /F "tokens=1-3 delims=:." %%v in ('echo %time%') do (set ctime=%%v%%w%%x)
rem
rem
set logpath=%AIRGROUP_LOG_ROOT%\MileagePlan\TransactionPurge\%logname%
rem
if not exist %logpath%\*.* md %logpath%
rem
set logfile=%logpath%\%logname%-%cdate%%ctime%.log
rem 
rem
echo **** Begin process **** >%logfile%
if exist %inpath%\%SQLInput% goto SetConnect
echo *** Cannot find SQL input file >>%logfile%
goto ErrorExit
:SetConnect
CALL ..\shared\Solar_Connect.cmd %logfile%
if not "%errorlevel%"=="0" goto ErrorExit
rem
:Startsql
rem
sqlplus -L %Uid%/%upw%@%DBConnect% @%inpath%\%SQLInput% >>%logfile%
if not "%errorlevel%"=="0" goto ErrorExit
echo **** Process Complete **** >>%logfile%
goto exit
rem
:ErrorExit
echo **** Processing error **** >>%logfile%
echo **** Processing error ****
:EXIT


