@ECHO OFF
SET SDMSHOST=%1
SET SDMSPORT=%2
SET JOBID=%3
SET KEY=%4
SET STEP=%5
SET PNAME=%6
IF NOT DEFINED PNAME SET PNAME=PERC_PROCESSED
SET SLEEP=2
SET P=0

:LOOP
SET /A P=%P%+%STEP%
IF %P% GTR 100 SET P=100
CALL SDMS-SET_VARIABLE --host %SDMSHOST% --port %SDMSPORT% --jid %JOBID% --key %KEY% %PNAME% %P%
SET EXITCODE=%ERRORLEVEL%
IF NOT %EXITCODE% EQU 0 GOTO DOEXIT
IF %P% EQU 100 GOTO END
SLEEP %SLEEP%
GOTO LOOP 

:END
SET EXITCODE=0

:DOEXIT
CMD /C EXIT %EXITCODE%

