DTS Task, Batch File and "Process returned code 255 error"

  • I am executing a DTS Package with an Execute Process Task Step that runs the following batch program. The program appears to run successfully ... it logs onto the FTP Site and downloads the files.

    My problem is the step returns a "Process returned code 255" error when I do not use the ERRORLEVEL Environment Variable. I want to use a more descriptive variable called %DOWNLOADEDALLFILES%.

    I get the error when I use the %DOWNLOADEDALLFILE% instead of the ERRORLEVEL Variable in the code under the REM *** RIGHT HERE *** below.

     

    :Begin

    pushd c:\FakeDirectory\files

    ftp -d -s:\\Server\SIGN.ftp pcdial.lehman.com

    echo ***** >> ftplog.txt

    echo FTP Connection Attempted (Established) at (Date\Time Below): >> ftplog.txt

    echo. | Date >> ftplog.txt

    echo. | Time >> ftplog.txt

    set r1=0

    set r2=0

    set r3=0

    set r4=0

    REM set ERRORLEVEL=1

    set DOWNLOADEDALLFILES=1

    Call  c:\Server\SIGNIS %r1% %r2% %r3% %r4%

    REM if "%r1%"==1 GOTO NOTREADY

    if "%r1%"=="1" GOTO NOTREADY

    REM If ERRORLEVEL or DOWNLOADEDALLFILES are set to zero that means the files were downloaded from the FTP Site, if not the batch program will sleep 10 minutes and try again.

    REM if "%r1%"=="0" if "%r2%"=="1" if "%r3%"=="1" if "%r4%"=="1" set ERRORLEVEL=0

    if "%r1%"=="0" if "%r2%"=="1" if "%r3%"=="1" if "%r4%"=="1" set DOWNLOADEDALLFILES=0

    REM *** RIGHT HERE ***

    REM if %ERRORLEVEL% 1 goto NOTREADY

    REM if %ERRORLEVEL% 0 goto END

    if %DOWNLOADEDALLFILES% 1 goto NOTREADY

    if %DOWNLOADEDALLFILES% 0 goto END

    goto END

    :NOTREADY

    sleep 600

    REM sleep 10

    goto Begin

    :END

  • All you need to do, is put two = signs between your custom error parameter and the value e.g.

    if %DOWNLOADEDALLFILES%==1 goto NOTREADY

    if %DOWNLOADEDALLFILES%==0 goto END

    Hope this helps.

     

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply