@ECHO OFF

rem *******************************************************************************
rem  Platform:      NT                                                            *
rem  Printstream:   PostScript                                                    *
rem  Application:   SPL Letter Print                                              *
rem ==============================================================================*
rem  Master Command File called to execute DOC1 for SPL Letter Print              *
rem ==============================================================================*

rem do not change the following line
SET   SPLLETR-CALLED-SWITCH=Y

rem *******************************************************************************
rem    Modify the following file paths for each installation                      *
rem ==============================================================================*
rem      D1HOST                                                                   *
rem              - Names root directory where the DOC1 Generate was installed     *
rem              - Typical value:                                                 *
rem                D1HOST=C:\Program Files\DOC1 Suite\Production Engines          *
rem      D1APPATH                                                                 *
rem              - Names directory containing HIP, OPS, INI, CTL, ETS             *
rem              - Sample coding:                                                 *
rem                D1APPATH=C:\Program Files\DOC1 Suite\Designer\resource\letr    *
rem      PRODPATH                                                                 *
rem              - Names directory for output files from Sort and DOC1            *
rem              - Sample coding: PRODPATH=C:\Doc1 Production Files               *
rem      XTRCTPTH                                                                 *
rem              - Names directory containing SPL Letter Print Extract            *
rem              - Sample coding: XTRCTPTH=C:\SPL\EXTRACT                         *
rem      PADDR_LETR_PRT                                                           *
rem              - IP Address where Letters will be printed                       *
rem              - Sample coding: PADDR_LETR_PRT=186.240.132.132                  *
rem *******************************************************************************

SET "outputpath=%SPLOUTPUT%\letters\web\"
SET   "WEBPATH=%outputpath%"
SET   "D1HOST=%DOC1HOSTDIR%\generate"
SET   "D1APPATH=%DOC1HOSTDIR%\AppFiles"
SET   "PRODPATH=%SPLOUTPUT%\letters\Prodfiles"
SET   "XTRCTPTH=%SPLOUTPUT%\letters\Extract"
SET   "SORTPATH=%WINDIR%\system32"
SET   "PADDR_LETR_PRT=63.162.50.9"

rem *******************************************************************************
rem    The following switches which enable certain steps to be bypassed           *
rem ==============================================================================*
rem      PRINTFILES                                                               *
rem              - May be:  Y or N                                                *
rem              - "N" prevents files from being sent to PADDR printer            *
rem      DELETEFILES                                                              *
rem              - May be:  Y or N                                                *
rem              - "N" prevents intermediate work files from being deleted        *
rem *******************************************************************************

SET   PRINTFILES=N
SET   DELETEFILES=Y

rem *******************************************************************************
rem    The following symbols are used for controls                                *
rem ==============================================================================*
rem      PSTREAM                                                                  *
rem              - Identifies the type of print description language for output   *
rem              - Possible values are AFP, PDF, or PostScript                    *
rem      RUN_TYPE                                                                 *
rem              - Distinguishes between online production vs batch production    *
rem              - Possible values are ONLINE and BATCH                           *
rem *******************************************************************************

SET   PSTREAM=PostScript
SET   RUN_TYPE=BATCH

rem *******************************************************************************
rem    The symbols identify application resource files for DOC1.  These values of *
rem    the file names should not be changed unless the files are either renamed   *
rem    or replaced.                                                               *
rem ==============================================================================*
rem   L O G F I L E                                                               *
rem   =============                                                               *
rem      LOGFILE                                                                  *
rem              - Name of a log file to be created by this process               *
rem              - Previous version of file will be replaced                      *
rem              - File will be written to %PRODPATH% directory                   *
rem              - Sample coding:  LOGFILE=SPL-fop.log                            *
rem                                                                               *
rem    D O C 1   R E S O U R C E   F I L E S                                      *
rem    =====================================                                      *
rem      GEN_OPS                                                                  *
rem              - Names DOC1GEN Initialization file for Format step              *
rem              - Sample value: GEN_OPS=splfop_s5_v1_doc1gen.ops                 *
rem              - File must be present in the %D1APPATH% directory               *
rem      GEN_HIP                                                                  *
rem              - Names DOC1GEN Application Rules (.HIP)                         *
rem              - Sample value: GEN_HIP=splfop_s5_v1_doc1gen.hip                 *
rem              - File must be present in the %D1APPATH% directory               *
rem      GEN_ETS                                                                  *
rem              - Names Lookup file                                              *
rem              - Sample value: GEN_ETS=splfop_s5_v1_doc1gen.ops                 *
rem              - File must be present in the %D1APPATH% directory               *
rem      FRGN_PCE_INI                                                             *
rem              - Names DOC1PCE Initialization file                              *
rem              - Sample value: FRGN_PCE_INI=splletr_s5_v3_frgnsplt_pce.ini      *
rem              - File must be present in the %D1APPATH% directory               *
rem      FRGN_PCE_CTL                                                             *
rem              - Names DOC1PCE Rules file                                       *
rem              - Sample value: FRGN_PCE_CTL=splletr_s5_v3_frgnsplt_pce.ctl      *
rem              - File must be present in the %D1APPATH% directory               *
rem      CPRT_PCE_INI                                                             *
rem              - Names DOC1PCE Initialization file                              *
rem              - Sample value: CPRT_PCE_INI=splletr_s5_v3_createprt_pce.ini     *
rem              - File must be present in the %D1APPATH% directory               *
rem      CPRT_PCE_CTL                                                             *
rem              - Names DOC1PCE Rules file                                       *
rem              - Sample value: CPRT_PCE_CTL=splletr_s5_v3_createprt_pce.ctl     *
rem              - File must be present in the %D1APPATH% directory               *
rem      LOGOXML                                                                  *
rem              - Names XML file that identifies the bitmap used for a company   *
rem                logo and contains sizing attributes of the bitmap              *
rem              - Sample value: LOGOXML=splletr_s5_v3_doc1gen_logo.xml           *
rem              - File must be present in the %D1APPATH% directory               *
rem                                                                               *
rem    S P L   L E T T E R   P R I N T   F I L E                                  *
rem    =========================================                                  *
rem      SPL_UNSORTED_EXTRACT                                                     *
rem              - Names SPL Letter Print Extract                                 *
rem              - Typical coding SPL_UNSORTED_EXTRACT=ltrxtr01.dat               *
rem                                                                               *
rem *******************************************************************************

set OUTPUTBASENAME=xx
SET   "LOGFILE=%OUTPUTBASENAME%.log"
IF .%OUTPUTBASENAME% == .                                          SET   "LOGFILE=spl-letter.log"

SET   "FRGN_PCE_INI=splletr_s5_v3_frgnsplt_pce.ini"
SET   "FRGN_PCE_CTL=splletr_s5_v3_frgnsplt_pce.ctl"
SET   "CPRT_PCE_INI=splletr_s5_v3_createprt_pce.ini"
SET   "CPRT_PCE_CTL=splletr_s5_v3_createprt_pce.ctl"

SET   "GEN_HIP=splletr_s5_v3_doc1gen_postscript.hip"
SET   "GEN_OPS=splletr_s5_v3_doc1gen.ops"
SET   "GEN_ETS=splletr_s5_v3_doc1gen.ets"
SET   "GEN_CNTL=splletr_s5_v3_doc1gen_control_postscript.ets"
SET   "LOGOXML=splletr_s5_v3_doc1gen_logo.xml"

SET   "SPL_UNSORTED_EXTRACT=%INPUTBASENAME%.DAT"
IF .%INPUTBASENAME% == .                                           SET   "SPL_UNSORTED_EXTRACT=LTRXTR01.DAT"

SET   "FNP="

IF    EXIST "%XTRCTPTH%\%SPL_UNSORTED_EXTRACT%"                    GOTO    HAVE-SPL-EXTRACT
ECHO No SPL Extract found "%XTRCTPTH%\%SPL_UNSORTED_EXTRACT%" - process bypassed
ECHO No SPL Extract found "%XTRCTPTH%\%SPL_UNSORTED_EXTRACT%" - process bypassed                    >> "%PRODPATH%\%LOGFILE%"
ECHO Process Ended with Completion Code 200                                                         >> "%PRODPATH%\%LOGFILE%"
GOTO  LETR-RUN-END

:HAVE-SPL-EXTRACT
CALL "%D1APPATH%\splletr_s5_v3_called_jobsteps.bat"

:LETR-RUN-END