@ECHO OFF
CLS
GOTO START
REM  ******************** \EXAMS\NEWDAF.BAT **********************
REM  *       Author: D.W. Disney, Senior Scientific/Engineering  *
REM  *                            Computer Specialist            *
REM  *               DynTel Corporation                          *
REM  *         Date: Tuesday, 20 February 1996.  Time: 10:30:53. *
REM  *  Environment: Microway 486 B2T/50, DOS 6.00               *
REM  * Installation: DynTel Corporation                          *
REM  *               U.S. Environmental Protection Agency        *
REM  *               NERL - Ecosystems Research Div., Athens, GA *
REM  *     Function: Execute EXAMS UTILITY program.              *
REM  *     Calling                                               *
REM  *     Sequence: NEWDAF                                      *
REM  *        Input: Command line: None                          *
REM  *               Other: none                                 *
REM  *************************************************************
REM  ----- Label START ------------------------------------------------------
:START
ECHO.
ECHO #
ECHO ##  Executing DOS batch command file %0
ECHO #   Preparing to build unformatted, direct access data and
ECHO #   help file EXAMS.DAF.
ECHO #
REM
IF "%1"=="DEBUG" GOTO CHECKEX1
IF "%1"=="debug" GOTO CHECKEX1
IF EXIST E:\EXAMS\UTILITY.EXE GOTO CHECKEX2
GOTO EXE_ERR1
REM  ----- Label CHECKEX1 ---------------------------------------------------
:CHECKEX1
IF EXIST \EXAMS\UTILITY.EXE GOTO CHECKEX2
GOTO EXE_ERR1
REM  ----- Label CHECKEX2 ---------------------------------------------------
:CHECKEX2
IF "%1"=="DEBUG" GOTO CHECKEX3
IF "%1"=="debug" GOTO CHECKEX3
IF EXIST E:\EXAMS\XEXAMSX.EXE GOTO CHECKDAT
GOTO EXE_ERR2
REM  ----- Label CHECKEX3 ---------------------------------------------------
:CHECKEX3
IF EXIST \EXAMS\XEXAMSX.EXE GOTO CHECKDAT
GOTO EXE_ERR2
REM  ----- Label CHECKDAT ---------------------------------------------------
:CHECKDAT
REM
IF "%1"=="DEBUG" GOTO CHK_DAF1
IF "%1"=="debug" GOTO CHK_DAF1
IF EXIST E:\EXAMS\EXAMS.DAF DEL E:\EXAMS\EXAMS.DAF
GOTO BEGIN
REM  ----- Label CHK_DAF1 ---------------------------------------------------
:CHK_DAF1
IF EXIST \EXAMS\EXAMS.DAF DEL \EXAMS\EXAMS.DAF
REM  ----- Label BEGIN ------------------------------------------------------
:BEGIN   
IF "%1"=="DEBUG" GOTO CHK_DAT1
IF "%1"=="debug" GOTO CHK_DAT1
IF NOT EXIST E:\EXAMS\UTILDATA\SPECS.DAT   GOTO FILE_ERR
IF NOT EXIST E:\EXAMS\UTILDATA\TYPE.DAT    GOTO FILE_ERR
IF NOT EXIST E:\EXAMS\UTILDATA\CHEMDAT.DAT GOTO FILE_ERR
IF NOT EXIST E:\EXAMS\UTILDATA\HELPFIL.DAT GOTO FILE_ERR
IF NOT EXIST E:\EXAMS\UTILDATA\ENCANON.DAT GOTO FILE_ERR
IF NOT EXIST E:\EXAMS\UTILDATA\HELPVAR.DAT GOTO FILE_ERR
IF NOT EXIST E:\EXAMS\UTILDATA\SETUP.EXA   GOTO FILE_ERR
IF NOT EXIST E:\EXAMS\UTILDATA\SETUP.INP   GOTO FILE_ERR
GOTO CHK_DAT2
REM  ----- Label CHK_DAT1 ---------------------------------------------------
:CHK_DAT1
IF NOT EXIST \EXAMS\UTILDATA\SPECS.DAT   GOTO FILE_ERR
IF NOT EXIST \EXAMS\UTILDATA\TYPE.DAT    GOTO FILE_ERR
IF NOT EXIST \EXAMS\UTILDATA\CHEMDAT.DAT GOTO FILE_ERR
IF NOT EXIST \EXAMS\UTILDATA\HELPFIL.DAT GOTO FILE_ERR
IF NOT EXIST \EXAMS\UTILDATA\ENCANON.DAT GOTO FILE_ERR
IF NOT EXIST \EXAMS\UTILDATA\HELPVAR.DAT GOTO FILE_ERR
IF NOT EXIST \EXAMS\UTILDATA\SETUP.EXA   GOTO FILE_ERR
IF NOT EXIST \EXAMS\UTILDATA\SETUP.INP   GOTO FILE_ERR
REM  ----- Label CHK_DAT2 ---------------------------------------------------
:CHK_DAT2
REM
IF "%1"=="DEBUG" GOTO COPYDAT1
IF "%1"=="debug" GOTO COPYDAT1
COPY E:\EXAMS\UTILDATA\*.DAT *.* /V >>UTIL_RUN.LOG
GOTO COPYDAT2
REM  ----- Label COPYDAT1 ---------------------------------------------------
:COPYDAT1
COPY \EXAMS\UTILDATA\*.DAT *.* /V >NUL
REM  ----- Label COPYDAT2 ---------------------------------------------------
:COPYDAT2
REM  ----- Label EXECUTE1 ---------------------------------------------------
:EXECUTE1
CLS
ECHO #
ECHO #----------------------------------------------------------------------#
ECHO ##  Executing EXAMS UTILITY program.
ECHO #----------------------------------------------------------------------#
ECHO #
ECHO #
ECHO ##  Loading and executing UTILITY program task image file...wait.
REM
IF "%1"=="DEBUG" SET LFDIR=D:\F77L3\BIN
IF "%1"=="debug" SET LFDIR=D:\F77L3\BIN
IF "%1"=="DEBUG" GOTO RUN_UTIL
IF "%1"=="debug" GOTO RUN_UTIL
SET LFDIR=E:\EXAMS
REM  ----- Label RUN_UTIL ---------------------------------------------------
:RUN_UTIL
IF "%1"=="DEBUG" \EXAMS\UTILITY
IF "%1"=="debug" \EXAMS\UTILITY
IF "%1"=="DEBUG" GOTO ENDURUN
IF "%1"=="debug" GOTO ENDURUN
ECHO #
ECHO #                                   >>UTIL_RUN.LOG
ECHO # ----- RUN DATE/TIME STAMP ----- # >>UTIL_RUN.LOG
ECHO # ----- Begin Execution     ----- # >>UTIL_RUN.LOG
ECHO #                                   >>UTIL_RUN.LOG
DATE <E:\EXAMS\RETURN1.ANS | FIND "C" >>UTIL_RUN.LOG
TIME <E:\EXAMS\RETURN1.ANS | FIND "C" >>UTIL_RUN.LOG
ECHO #                                   >>UTIL_RUN.LOG
E:\EXAMS\UTILITY
ECHO #                                   >>UTIL_RUN.LOG
ECHO # ----- End Execution       ----- # >>UTIL_RUN.LOG
ECHO #                                   >>UTIL_RUN.LOG
DATE <E:\EXAMS\RETURN1.ANS | FIND "C" >>UTIL_RUN.LOG
TIME <E:\EXAMS\RETURN1.ANS | FIND "C" >>UTIL_RUN.LOG
ECHO #                                   >>UTIL_RUN.LOG
ECHO # --------------------------------------------------- # >>UTIL_RUN.LOG
REM  ----- Label ENDURUN ----------------------------------------------------
:ENDURUN
ECHO #
ECHO ##  UTILITY program complete.
ECHO #
ECHO ##  Preparing to initialize new EXAMS.DAF file.
ECHO #
REM
IF "%1"=="DEBUG" GOTO COPYDAT3
IF "%1"=="debug" GOTO COPYDAT3
IF NOT EXIST E:\EXAMS\SETUP.EXA COPY E:\EXAMS\UTILDATA\SETUP.EXA *.* /V >>UTIL_RUN.LOG
IF NOT EXIST E:\EXAMS\SETUP.INP COPY E:\EXAMS\UTILDATA\SETUP.INP *.* /V >>UTIL_RUN.LOG
GOTO COPYDAT4
REM  ----- Label COPYDAT3 ---------------------------------------------------
:COPYDAT3
IF NOT EXIST \EXAMS\SETUP.EXA COPY \EXAMS\UTILDATA\SETUP.EXA *.* /V >NUL
IF NOT EXIST \EXAMS\SETUP.INP COPY \EXAMS\UTILDATA\SETUP.INP *.* /V >NUL
REM  ----- Label COPYDAT4 ---------------------------------------------------
:COPYDAT4
CLS
REM  ----- Label EXECUTE2 ---------------------------------------------------
:EXECUTE2
CLS
ECHO #
ECHO #----------------------------------------------------------------------#
ECHO ##  Executing EXAMS program.
ECHO #----------------------------------------------------------------------#
ECHO #
ECHO #
ECHO ##  Loading EXAMS program task image file...wait.
REM
REM  ----- Label RUN_EXAM ---------------------------------------------------
:RUN_EXAM
IF "%1"=="DEBUG" \EXAMS\XEXAMSX <SETUP.INP
IF "%1"=="debug" \EXAMS\XEXAMSX <SETUP.INP
IF "%1"=="DEBUG" GOTO ENDERUN
IF "%1"=="debug" GOTO ENDERUN
ECHO #
ECHO #                                   >>UTIL_RUN.LOG
ECHO # ----- RUN DATE/TIME STAMP ----- # >>UTIL_RUN.LOG
ECHO # ----- Begin Execution     ----- # >>UTIL_RUN.LOG
ECHO #                                   >>UTIL_RUN.LOG
DATE <E:\EXAMS\RETURN1.ANS | FIND "C" >>UTIL_RUN.LOG
TIME <E:\EXAMS\RETURN1.ANS | FIND "C" >>UTIL_RUN.LOG
ECHO #                                   >>UTIL_RUN.LOG
E:\EXAMS\XEXAMSX <SETUP.INP
ECHO #                                   >>UTIL_RUN.LOG
ECHO # ----- End Execution       ----- # >>UTIL_RUN.LOG
ECHO #                                   >>UTIL_RUN.LOG
DATE <E:\EXAMS\RETURN1.ANS | FIND "C" >>UTIL_RUN.LOG
TIME <E:\EXAMS\RETURN1.ANS | FIND "C" >>UTIL_RUN.LOG
ECHO #                                   >>UTIL_RUN.LOG
ECHO # --------------------------------------------------- # >>UTIL_RUN.LOG
REM  ----- Label ENDERUN ----------------------------------------------------
:ENDERUN
ECHO #
ECHO ##  EXAMS program complete.
ECHO #
GOTO END
REM  ----- Label FILE_ERR ---------------------------------------------------
:FILE_ERR
ECHO #
ECHO # ----------------------------------------------------------------------
ECHO #
ECHO ##  WARNING:  ONE OR MORE SEQUENTIAL FILES MISSING
ECHO #
ECHO #             One or more of the following sequential files needed to
ECHO #             execute the UTILITY and EXAMS programs that build the
ECHO #             EXAMS.DAF are missing from the UTILDATA sub-directory:
ECHO #             SPECS.DAT, TYPE.DAT, CHEMDAT.DAT, HELPFIL.DAT,
ECHO #             ENCANON.DAT, HELPVAR.DAT, SETUP.EXA, and/or SETUP.INP.
ECHO #
ECHO #             Install and/or copy these files to sub-directory UTILDATA
ECHO #             or call CEAM for assistance.  Refer to file READ.ME for
ECHO #             phone number.
ECHO #
ECHO #   Press "<Enter>" key to return to DOS command prompt.
PAUSE >NUL
GOTO END
REM  ----- Label EXE_ERR1 ---------------------------------------------------
:EXE_ERR1
ECHO #
ECHO # ----------------------------------------------------------------------
ECHO #
ECHO ##  ERROR:  BAD OR MISSING UTILITY.EXE FILE
ECHO #
ECHO #           The UTILITY program executable task image file UTILITY.EXE
ECHO #           is not located in the DOS sub-directory E:\EXAMS.
ECHO #
ECHO #           Install and/or copy this file and all of its support files
ECHO #           to sub-directory E:\EXAMS or call CEAM for assistance.
ECHO #           Refer to file READ.ME for phone number.
ECHO #
ECHO #   Press "<Enter>" key to return to DOS command prompt.
PAUSE >NUL
GOTO END
REM  ----- Label EXE_ERR2 ---------------------------------------------------
:EXE_ERR2
ECHO #
ECHO # ----------------------------------------------------------------------
ECHO #
ECHO ##  ERROR:  BAD OR MISSING XEXAMSX.EXE FILE
ECHO #
ECHO #           The EXAMS program executable task image file XEXAMSX.EXE
ECHO #           is not located in the DOS sub-directory E:\EXAMS.
ECHO #
ECHO #           Install and/or copy this file and all of its support files
ECHO #           to sub-directory E:\EXAMS or call CEAM for assistance.
ECHO #           Refer to file READ.ME for phone number.
ECHO #
ECHO #   Press "<Enter>" key to return to DOS command prompt.
PAUSE >NUL
REM  ----- Label END --------------------------------------------------------
:END
CLS
ECHO.
ECHO #
ECHO ##  Cleaning up work files...wait.
ECHO #
REM
IF EXIST SPECS.DAT   DEL SPECS.DAT
IF EXIST TYPE.DAT    DEL TYPE.DAT
IF EXIST CHEMDAT.DAT DEL CHEMDAT.DAT
IF EXIST FOR007.DAT  DEL FOR007.DAT
IF EXIST HELPFIL.DAT DEL HELPFIL.DAT
IF EXIST ENCANON.DAT DEL ENCANON.DAT
IF EXIST HELPVAR.DAT DEL HELPVAR.DAT
IF EXIST SETUP.EXA   DEL SETUP.EXA
IF EXIST SETUP.INP   DEL SETUP.INP
CLS
ECHO.
ECHO #
ECHO ##  Execution of DOS batch command file %0 complete.
IF EXIST EXAMS.DAF ECHO #   New EXAMS.DAF file ready.
IF EXIST EXAMS.DAF ECHO #
IF EXIST EXAMS.DAF DIR EXAMS.DAF
IF NOT EXIST EXAMS.DAF ECHO #   ERROR: New EXAMS.DAF file not found in current sub-directory.
IF NOT EXIST EXAMS.DAF ECHO #
SET LFDIR=
ECHO.
ECHO.
:STOP
