 REM -- H2XSZA.BAT - 31.4 PG/SUZUKI.AUTO(EPC/DCS) INTFC -     ..1998JAN26VM
 REM --                   ..2000JUL18PE/2006JAN04PE/2006MAR14PE/2009MAY12PE
@ECHO Off
 REM -- COPYRIGHT (C) 1997-2009 H.W.PETER, WUPPERTAL .DE --
 REM -- COPYRIGHT (C) 1997-2009 PETER+GEISENDORF GMBH, SPROCKHOEVEL .DE --

 REM -- \\UFN=OK, 2002OCT18PE/2003FEB19PE
 REM -- EPCnoSENSE=*=C:\PGIMPORT\SUZUEPC*.CFW
 REM -- EPCnoSENSE=!

 REM 6789.123456789.123456789.123456789.123456789.123456789.123456789.12345
 REM ----------------------------------------------------------------------

 IF "%1"=="EPC" GOTO EPC
 IF "%1"=="ETK" GOTO EPC

 IF "%1"=="OQX" GOTO OQX
 IF "%1"=="FT"  GOTO OQX

ECHO ----------------------------------------------------------
ECHO %0:
ECHO INVALID CONTEXT CALL
ECHO UNGUELTIGER AUFRUF
ECHO ----------------------------------------------------------
ECHO %0 %1 %2 %3 %4 %5 %6 %7 %8 %9
 PAUSE
 GOTO ENDUP

REM 
REM -- H2XSZA.BAT/H2XLCS.BAT/H2XBAH.BAT - EPC ENTRY --

:EPC
rem -- %0=H2XSZA %1=EPC/ETK %2=homedisk %3=homepath %4=requestor(WHO)
rem -- %5=PC4xxxxx.PGO %6=station## %7=KA/SU/YA %8=HCode %9=IdentNr

rem -- create valid directory entry for data import --
IF     EXIST C:\PGIMPORT\*.*   GOTO EPCLOC22
IF     EXIST C:\PGIMPORT\NUL   GOTO EPCLOC22
IF     EXIST C:\PGIMPORT\NUL:  GOTO EPCLOC22
MD           C:\PGIMPORT
:EPCLOC22

REM -- try local processing first --
:EPCLOC
SET PGOEPCDI=C:
SET PGOEPCDJ=SUZU-EPC
IF     EXIST %PGOEPCDI%\%PGOEPCDJ%\SUZUEPC.EXE        GOTO EPCLOC24
IF     EXIST %PGOEPCDI%\%PGOEPCDJ%\VT.EXE             GOTO EPCLOC26
rem -- beg special STORM HL 2006MAR14PE
rem SET PGOEPCDI=D:
IF     EXIST %PGOEPCDI%\%PGOEPCDJ%\SUZUEPC.EXE        GOTO EPCLOC24
IF     EXIST %PGOEPCDI%\%PGOEPCDJ%\VT.EXE             GOTO EPCLOC26
SET PGOEPCDI=C:
rem -- end special STORM HL 2006MAR14PE
IF     EXIST H2XBAH.BAT                               GOTO EPCLOC28
GOTO EPCLOCX

:EPCLOC24
REM -- execute EPC program (V9) unless export file already stored --
rem ** %PGOEPCDI%
rem ** CD \
rem ** CD %PGOEPCDJ%
IF     EXIST C:\PGIMPORT\SUZUEPC*.CFW                 GOTO EPCLOC4
rem ** CD \
NET USE  Q: /DELETE /YES   >NUL:
SUBST    Q: %PGOEPCDI%\
rem ** CD %PGOEPCDJ%
rem ** rem ** CD START
IF "%PGONETID%"=="W95" SET PGOEPCPI=START /W
%PGOEPCPI% %PGOEPCDI%\%PGOEPCDJ%\SUZUEPC.EXE /VIN=%9 /OUT=C:\PGIMPORT\SUZUEPC0.CFW
rem ** CD \
SUBST    Q: /D >NUL:
GOTO EPCLOC4

:EPCLOC26
REM -- execute EPC program (16) unless export file already stored --
rem ** %PGOEPCDI%
rem ** CD \
rem ** CD %PGOEPCDJ%
IF     EXIST VT.1%6                                   GOTO EPCLOC4
rem ** CD \
NET USE  Q: /DELETE /YES   >NUL:
SUBST    Q: %PGOEPCDI%\
rem ** CD %PGOEPCDJ%
rem ** CD START
IF "%PGONETID%"=="W95" SET PGOEPCPI=START /W
%PGOEPCPI% %PGOEPCDI%\%PGOEPCDJ%\VT   /VID=%9 /ST=1%6
rem ** CD \
SUBST    Q: /D >NUL:
GOTO EPCLOC4

:EPCLOC28
rem -- BELL+HOWELL interface --
IF NOT EXIST H2XBAH.BAT                GOTO EPCLOCX
IF NOT EXIST C:\FINDER\FINDER.EXE      GOTO EPCLOCX
rem ** H2XBAH.BAT %1 %2 %3 SZA %5 %6 %7 %8 %9
EXIT

REM 
REM -- H2XSZA.BAT/H2XLCS.BAT - EPC LOCAL EXIT/DENY --

:EPCLOC4
rem ** CD \
REM -- switch back to home drive and home directory --
rem ** %2
rem ** CD \
rem ** CD %3

:EPCLOC6
IF NOT EXIST       C:\PGIMPORT\SUZUEPC*.CFW           GOTO EPCLOC64
COPY /B PC4FID.SZA+C:\PGIMPORT\SUZUEPC*.CFW           %5 /V >NUL:
DEL                C:\PGIMPORT\SUZUEPC*.CFW               
GOTO EPCLOC68
:EPCLOC64

IF NOT EXIST       VT.1%6                             GOTO EPCLOC66
COPY /B PC4FID.SZA+VT.1%6                             %5 /V >NUL:
DEL                VT.1%6
GOTO EPCLOC68
:EPCLOC66

:EPCLOC68
GOTO EPCEND


:EPCLOCX

REM 
REM -- H2XSZA.BAT/H2XLCS.BAT - Windows95 Network Mgr interface --

:EPCW95
IF NOT "%PGONETID%"=="W95" GOTO EPCW95X

rem ** C:
rem ** CD \
rem -- try to locate possible server cpu (\\LCS, \\EPC, .. or \\PGO) --
SET PGOEPCDI=Q:
SET PGOEPCDJ=SUZU-EPC

rem -- learn mode: try to re-use previously found server --
SET PGOEPCDS=
rem ** IF EXIST %2%3\H2XLCS$0.BAT CALL %2%3\H2XLCS$0.BAT
IF EXIST H2XLCS$0.BAT CALL H2XLCS$0.BAT
IF "%PGOEPCDS%"=="" GOTO EPCW9512
NET VIEW    \\%PGOEPCDS%   >NUL:
IF ERRORLEVEL 1 GOTO EPCW9512
NET USE  Q: /DELETE /YES   >NUL:
NET USE  Q: \\%PGOEPCDS%\C >NUL:
IF EXIST Q:\%PGOEPCDJ%\SUZUEPC.EXE                    GOTO EPCW952
IF EXIST Q:\%PGOEPCDJ%\VT.EXE                         GOTO EPCW952

:EPCW9512
rem -- learn mode: previously found server is now unavailable --
rem ** IF EXIST %2%3\H2XLCS$0.BAT DEL  %2%3\H2XLCS$0.BAT
IF EXIST H2XLCS$0.BAT DEL  H2XLCS$0.BAT

rem -- search mode: try to locate an appropriate server --
SET PGOEPCDS=LCS
ECHO ... searching for server %PGOEPCDS%
NET VIEW    \\%PGOEPCDS%   >NUL:
IF ERRORLEVEL 1 GOTO EPCW9514
NET USE  Q: /DELETE /YES   >NUL:
NET USE  Q: \\%PGOEPCDS%\C >NUL:
IF EXIST Q:\%PGOEPCDJ%\SUZUEPC.EXE                    GOTO EPCW952
IF EXIST Q:\%PGOEPCDJ%\VT.EXE                         GOTO EPCW952
:EPCW9514

SET PGOEPCDS=EPC
ECHO ... searching for server %PGOEPCDS%
NET VIEW    \\%PGOEPCDS%   >NUL:
IF ERRORLEVEL 1 GOTO EPCW951E
NET USE  Q: /DELETE /YES   >NUL:
NET USE  Q: \\%PGOEPCDS%\C >NUL:
IF EXIST Q:\%PGOEPCDJ%\SUZUEPC.EXE                    GOTO EPCW952
IF EXIST Q:\%PGOEPCDJ%\VT.EXE                         GOTO EPCW952
:EPCW951E

SET PGOEPCDS=PGO
ECHO ... searching for server %PGOEPCDS%
NET VIEW    \\%PGOEPCDS%   >NUL:
IF ERRORLEVEL 1 GOTO EPCW951P
NET USE  Q: /DELETE /YES   >NUL:
NET USE  Q: \\%PGOEPCDS%\C >NUL:
IF EXIST Q:\%PGOEPCDJ%\SUZUEPC.EXE                    GOTO EPCW952
IF EXIST Q:\%PGOEPCDJ%\VT.EXE                         GOTO EPCW952
:EPCW951P

NET USE  Q: /DELETE /YES   >NUL:
GOTO EPCW95X

REM 
REM -- H2XSZA.BAT/H2XLCS.BAT - Windows95 Network Mgr interface (cont.) --

:EPCW952
rem -- learn mode: establish service .BAT file entry for server found --
rem ** IF EXIST %2%3\H2XLCS$0.BAT GOTO EPCW952L
rem **        ECHO SET PGOEPCDS=%PGOEPCDS%...)... %2%3\H2XLCS$0.BAT
IF EXIST H2XLCS$0.BAT                                 GOTO EPCW952L
       ECHO SET PGOEPCDS=%PGOEPCDS%> H2XLCS$0.PGO
       REN  H2XLCS$0.PGO H2XLCS$0.BAT
:EPCW952L

IF     EXIST %PGOEPCDI%\%PGOEPCDJ%\SUZUEPC.EXE        GOTO EPCW9524
IF     EXIST %PGOEPCDI%\%PGOEPCDJ%\VT.EXE             GOTO EPCW9526
GOTO EPCW95X

:EPCW9524
REM -- execute EPC program (V9) unless export file already stored --
rem ** %PGOEPCDI%
rem ** CD \
rem ** CD %PGOEPCDJ%
IF     EXIST C:\PGIMPORT\SUZUEPC*.CFW                 GOTO EPCW954
rem ** CD \
rem ** CD %PGOEPCDJ%
rem ** rem ** CD START
IF "%PGONETID%"=="W95" SET PGOEPCPI=START /W
%PGOEPCPI% %PGOEPCDI%\%PGOEPCDJ%\SUZUEPC.EXE /VIN=%9 /OUT=C:\PGIMPORT\SUZUEPC0.CFW
rem ** CD \
GOTO EPCW954

:EPCW9526
REM -- execute EPC program (16) unless export file already stored --
rem ** %PGOEPCDI%
rem ** CD \
rem ** CD %PGOEPCDJ%
IF     EXIST VT.1%6                                   GOTO EPCW954
rem ** CD \
rem ** CD %PGOEPCDJ%
rem ** CD START
IF "%PGONETID%"=="W95" SET PGOEPCPI=START /W
%PGOEPCPI% %PGOEPCDI%\%PGOEPCDJ%\VT   /VID=%9 /ST=1%6
rem ** CD \
GOTO EPCW954


:EPCW954
rem ** CD \

REM -- switch back to home drive and home directory --
rem ** %2
rem ** CD \
rem ** CD %3

:EPCW956
IF NOT EXIST       C:\PGIMPORT\SUZUEPC*.CFW           GOTO EPCW9564
COPY /B PC4FID.SZA+C:\PGIMPORT\SUZUEPC*.CFW           %5 /V >NUL:
DEL                C:\PGIMPORT\SUZUEPC*.CFW               
GOTO EPCW9568
:EPCW9564

IF NOT EXIST       VT.1%6                             GOTO EPCW9566
COPY /B PC4FID.SZA+VT.1%6                             %5 /V >NUL:
DEL                VT.1%6
GOTO EPCW9568
:EPCW9566

:EPCW9568
NET USE Q: /DELETE /YES >NUL:
GOTO EPCEND

:EPCW95X

REM 
REM -- H2XSZA.BAT/H2XLCS.BAT - EPC FINAL --

REM -- procedure may be extended here for a different context --
REM -- otherwise default to return to PGO mainline process --

ECHO ---------------------------------------------
ECHO %0:
ECHO CANNOT FIND EPC INSTALLATION        ...RETURN
ECHO ETK INSTALLATION NICHT ERREICHBAR   ...RETURN
ECHO ---------------------------------------------
PAUSE
GOTO EPCEND

:EPCEND
rem ** %2
rem ** CD \
rem ** CD %3
IF EXIST           %5 GOTO EPCEND6
COPY /B PC4FID.SZA %5 /V >NUL:
:EPCEND6
GOTO ENDUP

REM 
REM -- H2XSZA.BAT - OQX order queue transfer to SUZUKI MR server/check--

:OQX

rem -- %0=H2XSZA %1=OQX/FT %2=homedisk %3=homepath --
rem -- %4=OQ*.SZA file id %5=HDLRNR(L=6) %6=T/WMJ.. %7=PSW %8=WHO --
rem -- **** 2002FEB24 preliminary test layout - prx avis 2002APR02 ****
rem -- set classpath=c:\Suzuki\%5\DealerCom;c:\Suzuki\%5\DealerCom\dcApplet.jar;c:\Suzuki\%5\DealerCom\xml.jar
rem -- set Path=C:\WINDOWS\SYSTEM;%PATH%

:OQX3
rem -- do NOT create a directory named SZMDCS (!) --
rem -- check for Suzuki/DCS references --
rem SET PGOEPCDI=C:
rem SET PGOEPCDJ=Suzuki
SET PGOEPCDL=
IF     EXIST SZMDCS\DMSCli*.exe   GOTO OQX3B

:OQX3A
IF     EXIST OQ*.SZA             DEL  OQ*.SZA
ECHO -- Suzuki DCS installation not found --
PAUSE >NUL:
rem -- CD \
GOTO OQXEND

:OQX3B
rem -- accept Suzuki entry (OQ*.SZA) --
:OQX3X
rem -- create valid destin filename entry for data export --
                        SET PGOEPCPI=_S
                        SET PGOEPCPI=_S
IF     "%6%"=="1"       SET PGOEPCPI=_V
IF     "%6%"=="T"       SET PGOEPCPI=_V
IF     "%6%"=="3"       SET PGOEPCPI=_W
IF     "%6%"=="M"       SET PGOEPCPI=_W

REM 
REM -- H2XSZA.BAT - OQX order queue transfer to SUZUKI MR server/prepare --

rem -- post file(s) to transfer --
:OQX4
IF     EXIST OQ*.SZA  GOTO OQX42
SET PGOEPCDL=-dlOnly
ECHO -------------------------------------------------
ECHO -- HINWEIS: 
ECHO -- Es stehen keine NEUEN Order-Bestaende zur
ECHO -- Uebertragung zur Verfuegung.
ECHO --
GOTO OQX46

:OQX42
FOR %%A IN  (OQ*.SZA) DO COPY /B %%A SZMDCS\Upload\%5%PGOEPCPI%.txt >NUL:
IF     EXIST OQ*.SZA  DEL    OQ*.SZA
GOTO OQX46

:OQX46
DIR          SZMDCS\Upload\%5%PGOEPCPI%.txt
ECHO -------------------------------------------------
ECHO %0 - ET-Order:
ECHO -- Die zu uebertragende Datei finden Sie
ECHO -- auf diesem Computer im Verzeichnis
ECHO --     %2%3\SZMDCS\Upload
ECHO -- unter dem Namen
ECHO --     %5%PGOEPCPI%.txt
ECHO -- fuer den elektronischen Versand bereitgestellt
ECHO --
ECHO -- Start der Internet-Kommunikation...
ECHO --                                      ...RETURN
ECHO -------------------------------------------------
PAUSE >NUL:

REM 
REM -- H2XSZA.BAT - OQX order queue transfer to SUZUKI MR server/params --

rem -- try to setup DMSSettings.properties - SZA(HP).W/D:2002MAR27(TEL) --
:OQX5

CD SZMDCS

          SET PGOEPCPU="DMSSettings.properties"
IF     EXIST %PGOEPCPU%         GOTO OQX52
          SET PGOEPCPU=DMSSET~1.PRO
IF     EXIST %PGOEPCPU%         GOTO OQX52
          SET PGOEPCPU=DMSSETTI.PRO
IF     EXIST %PGOEPCPU%         GOTO OQX52
          SET PGOEPCPU=DMSSettings.properties
IF     EXIST %PGOEPCPU%         GOTO OQX52
  GOTO OQX58

:OQX52
IF     EXIST DMSSETNO.PGO       GOTO OQX58
rem -- existance of this file will prohibit update attempt --
ECHO #BY PGOFFICE>              %PGOEPCPU%
ECHO LogFileNameDMS=DMS.log>>   %PGOEPCPU%
ECHO UserName=ZD%5>>            %PGOEPCPU%
ECHO Password=%7>>              %PGOEPCPU%
ECHO FileUploadDir=Upload>>     %PGOEPCPU%
ECHO FileMoveDir=Sent>>         %PGOEPCPU%
ECHO FileDownloadDir=Download>> %PGOEPCPU%
ECHO lang=DE>>                  %PGOEPCPU%
:OQX58

REM 
REM -- H2XSZA.BAT - OQX order queue transfer to SUZUKI MR server/transfer --

rem -- try to call link procedure(s) --
:OQX6
GOTO OQX62

:OQX62

:OQX63
IF     EXIST DMSCli*.exe     GOTO OQX632
ECHO -- Suzuki DMSClient.exe not available --
PAUSE >NUL:
GOTO OQX638
:OQX632
                        SET PGOEPCPI=S
IF     "%6%"=="1"       SET PGOEPCPI=V
IF     "%6%"=="T"       SET PGOEPCPI=V
IF     "%6%"=="3"       SET PGOEPCPI=W
IF     "%6%"=="M"       SET PGOEPCPI=W
IF NOT "%PGOEPCDL%"=="" SET PGOEPCPI=%PGOEPCDL%

          SET PGOEPCPX=DMSCLI~1.EXE
IF     EXIST %PGOEPCPX%         GOTO OQX634
          SET PGOEPCPX=DMSClient.exe
IF     EXIST %PGOEPCPX%         GOTO OQX634
          SET PGOEPCPX=DMSClien.exe
IF     EXIST %PGOEPCPX%         GOTO OQX634
          SET PGOEPCPX="DMSClient.exe"

:OQX634
rem -- WinXP: Start "title"... 2005MAY24PE
       START /wait %PGOEPCPX% %PGOEPCPI%
GOTO OQX638
:OQX638

:OQX64

REM 
REM -- H2XSZA.BAT - OQX order queue transfer to SUZUKI MR server/analyze --

:OQX66

CD ..

ECHO -------------------------------------------------
ECHO --
ECHO -- Die Internet-Verbindung
ECHO -- wird nicht mehr benoetigt.
ECHO --                                      ...RETURN
ECHO -------------------------------------------------
PAUSE >NUL:

rem -- initialize reply file --
IF     EXIST OR001F.DA0  DEL OR001F.DA0
IF     EXIST OR001F.DAT  REN OR001F.DAT OR001F.DA0
IF     EXIST OR001F.DA0  GOTO OQX6608
ECHO #SIEDCS0 BY PGOFFICE>              OR001F.DA0
:OQX6608
   
IF NOT EXIST SZMDCS\Sent\*.txt                 GOTO OQX66S8
rem -- append data sent report to reply file
ECHO #SIEDCSS BY PGOFFICE>>             OR001F.DA0
FOR %%A IN  (SZMDCS\Sent\*.txt) DO TYPE %%A >> OR001F.DA0
DEL          SZMDCS\Sent\*.txt
:OQX66S8

IF NOT EXIST SZMDCS\DMS.log                    GOTO OQX66L8
rem -- append xfer report to reply file
ECHO #SIEDCSL BY PGOFFICE>>             OR001F.DA0
FOR %%A IN  (SZMDCS\DMS.log) DO TYPE %%A >> OR001F.DA0
DEL          SZMDCS\DMS.log 
:OQX66L8

IF NOT EXIST SZMDCS\Download\*.txt             GOTO OQX66D8
rem -- append download report to reply file
ECHO #SIEDCSD BY PGOFFICE>>             OR001F.DA0
FOR %%A IN  (SZMDCS\Download\*.txt)  DO TYPE %%A >> OR001F.DA0
DEL          SZMDCS\Download\*.txt
:OQX66D8

GOTO OQX68
:OQX68
IF     EXIST OR001F.DA9  DEL OR001F.DA9
IF     EXIST OR001F.DA8  REN OR001F.DA8 OR001F.DA9
IF     EXIST OR001F.DA7  REN OR001F.DA7 OR001F.DA8
IF     EXIST OR001F.DA6  REN OR001F.DA6 OR001F.DA7
IF     EXIST OR001F.DA5  REN OR001F.DA5 OR001F.DA6
IF     EXIST OR001F.DA4  REN OR001F.DA4 OR001F.DA5
IF     EXIST OR001F.DA3  REN OR001F.DA3 OR001F.DA4
IF     EXIST OR001F.DA2  REN OR001F.DA2 OR001F.DA3
IF     EXIST OR001F.DA1  REN OR001F.DA1 OR001F.DA2
IF     EXIST OR001F.DA0  REN OR001F.DA0 OR001F.DA1
                     COPY /B OR001F.DA1 OR001F.DAT

GOTO OQXEND

:OQXEND
GOTO ENDUP

REM 
REM -- H2XSZA.BAT - FINAL --

:ENDUP
SET PGOEPCDI=
SET PGOEPCDJ=
SET PGOEPCDL=
SET PGOEPCPD=
SET PGOEPCPI=
SET PGOEPCPU=
SET PGOEPCPx=

REM -- now return to PGO home drive and resume PGO mainline --
rem -- %2
rem -- CD \
rem -- CD %3
SET  PGOEPCPI=PGOBEG
IF "%PGONETID%"=="W10" SET PGOEPCPI=START /R /MAX PGOFFICE.PIF
IF "%PGONETID%"=="W16" SET PGOEPCPI=START /R /MAX PGOFFICE.PIF
IF "%PGONETID%"=="W95" SET PGOEPCPI=START /R /MAX PGOFFICE.PIF
IF "%PGOEPCEX%"=="END" SET PGOEPCPI=
%PGOEPCPI%
EXIT
