@SET DBVER=35
@SET DBPRV=34
@SET DBPRVPATH=z:\Archief\FACILITOR\2018\01\DB34a\FCLT34a.sql
::=============================
@SET BUILD=z:\Project\FACILITOR\BUILD

IF EXIST %DBPRVPATH% GOTO START
ECHO %DBPRVPATH% niet gevonden
PAUSE
GOTO EINDE

:START
@echo off
REM Usage: %0

PUSHD z:\Project\FACILITOR\Database\trunk
CALL mx NOWAIT
POPD
:START0
IF EXIST %BUILD%\DB%DBVER%\FCLT%DBVER%.sql GOTO STARTCREA
ECHO %BUILD%\DB%DBVER%\FCLT%DBVER%.sql niet gevonden
PAUSE
GOTO EINDE
:STARTCREA

ECHO Starting Create, see diffwork_%DBVER%.lst
ECHO Starting Create>diffwork_%DBVER%.lst
CALL _CREA_WORK %DBVER% z:\Project\FACILITOR\BUILD>>diffwork_%DBVER%.lst

ECHO Starting Update, see diffwork_%DBVER%.lst
ECHO Starting Update>>diffwork_%DBVER%.lst
CALL _CREA_WORK_UPDATE %DBPRV% %DBPRVPATH% %DBVER% z:\Project\FACILITOR\BUILD>>diffwork_%DBVER%.lst

ECHO Starting Compare, see diffwork_%DBVER%.lst
ECHO Starting Compare>>diffwork_%DBVER%.lst
cscript compare.js %DBPRV% %DBVER% >>diffwork_%DBVER%.lst 2>>&1

findstr /i "ORA-" "diffwork_%DBVER%.lst"
if %errorlevel%==1 GOTO EINDE

findstr /C:"ORA-" "diffwork_%DBVER%.lst" | cscript emailerror.js
@TITLE ORA-Errors found, e-mail sent
PAUSE

:EINDE