 rem #New 01.03.2019/J.Fes
 rem #Description: pruges / clear fcc cashe if program %~1 is not running

 set JobMgr_fccPurge_ChkIfPrgIsRunning=%~1
 set JobMgr_fccPurge_ChkIfPrgIsRunning_r=
 if not defined JobMgr_fccCheck_USE if "%~2" neq "" set JobMgr_fccCheck_USE=%~2


 if /I "%JobMgr_fccPurge_ChkIfPrgIsRunning%" equ "" goto :fccPurgeNOMissingPara
 if /I "%JobMgr_fccCheck_USE%" equ "true" goto :fccPurgeYES
 goto :fccPurgeNO


:fccPurgeYES
 call :fccPurgeDo
 Call Echo "fcc purge result please see log.: %JobMgr_fccPurge_DPNE%"
 goto :myEnd

:fccPurgeNO
 Call Echo "fcc purge.......................: is disabled"
 Call Echo "Enable fcc purge via............: set JobMgr_fccCheck_USE=true"
 goto :myEnd

:fccPurgeNOMissingPara
 Call Echo "fcc purge.......................: NO because Parameter is missing"
 Call Echo "#Doc:use fccpruge via...........: call fccCheck.cmd MyProgramName.exe true"
 Call Echo "#Doc:please see also Env........: set JobMgr_fccCheck_USE=true"
 if /i "%JobMgr_Debug%" neq "ON" goto :JumbOverDebug
  call Echo "---------------------------------------------------------------------------"
  call Echo "#Debug..........................: #Desctription (%~0)"
  call Echo "#toRun..........................: %toRunForPrint%"
  pause
 :JumbOverDebug
 goto :myEnd

:myEnd
goto :eof

REM ----------------------------------------------------------------------------
:fccPurgeDo
 rem -- #New:27.02.2019  JobMgr_fccPurge autocontrol
 call "%BinPublic_DP%\cmdUti_DateTimeNowGet.cmd"
 set JobMgr_fccPurge_DP=#11-Doku_DP#\zz_fccPurge_log
 set JobMgr_fccPurge_DPNE=%JobMgr_fccPurge_DP%\%$DateYYYY%-%$DateMM%-%$DateDD%-%$timeHH%_%ComputerName%_fccPurge_log.txt
 if not exist "%JobMgr_fccPurge_DP%" md "%JobMgr_fccPurge_DP%"

 call "%BinPublic_DP%\ProgIs_Running.cmd" "%JobMgr_fccPurge_ChkIfPrgIsRunning%"  JobMgr_fccPurge_ChkIfPrgIsRunning_r  EchoOff

 Call Echo "----------------------------------------------------------------------------" "%JobMgr_fccPurge_DPNE%"
 Call Echo "Check if Program is running.....: %JobMgr_fccPurge_ChkIfPrgIsRunning% // Result:%JobMgr_fccPurge_ChkIfPrgIsRunning_r%"

 if /I "%JobMgr_fccPurge_ChkIfPrgIsRunning_r%" equ "0" (
    Call Echo "perform:fcc purge...............: YES because Prg:'%JobMgr_fccPurge_ChkIfPrgIsRunning%' Is --NOT-- running " "%JobMgr_fccPurge_DPNE%"
    Call Echo "----  ----  before purge ---  ----  ----  ----  ----  ----  ----  ----  ----" "%JobMgr_fccPurge_DPNE%"
REM     Call Echo "fcc status (-x) before purge....: \\%ComputerName% " "%JobMgr_fccPurge_DPNE%"
    Call fccstat -x >>"%JobMgr_fccPurge_DPNE%"
    Call Echo "fcc performe -clear on..........: \\%ComputerName%" "%JobMgr_fccPurge_DPNE%"
    call fccstat -clear >>"%JobMgr_fccPurge_DPNE%"
    Call Echo "fcc performe -purge on..........: \\%ComputerName%" "%JobMgr_fccPurge_DPNE%"
    call fccstat -purge >>"%JobMgr_fccPurge_DPNE%"
    Call Echo "----  ----  after purge _---  ----  ----  ----  ----  ----  ----  ----  ----" "%JobMgr_fccPurge_DPNE%"
REM     Call Echo "fcc status (-x) after purge.....: \\%ComputerName%" "%JobMgr_fccPurge_DPNE%"
    Call fccstat -x >>"%JobMgr_fccPurge_DPNE%"
 ) else (
    Call Echo "perform:fcc purge...............: NO because Prg:'%JobMgr_fccPurge_ChkIfPrgIsRunning%' Is running " "%JobMgr_fccPurge_DPNE%"
 )

 goto :eof
