Use of Errorlevel with FTMSCMD

FTMSCMD passes back return codes to assist programmers in writing batch jobs.

The following example batch job executes a transfer. A message is displayed indicating the success or failure of the transfer.
@echo off 
FTMSCMD /nologo /lu:danl1i2 /ri:ftmsusr1 /rw:ftmspswd /rl:80 /rf:f
“c:\data\production information file1.dat” prftms.xabl.data.prodinf1
2>errorlog.txt 

if errorlevel 1 goto ERROR 
if errorlevel 0 goto SUCCESS 

:ERROR 
   echo transfer failed 
   goto END

:SUCCESS 
   echo transfer successful 
   goto END

:END 
   echo batch program complete

Overview of Sample Batch Program

The first line @echo off instructs the batch program not to write messages to the screen. The second and third lines indicate the file transfer.

Note: /NOLOGO is used to instruct the FTMSCMD program not to display product information when performing the transfer. 2>errorlog.txt writes any message that is issued during this batch job to errorlog.txt.

The next line directs the batch job to skip to the area labeled :ERROR and perform the tasks in that area if the error level passed back from the ASNA program is 1.

The next line directs the batch job to skip to the area labeled :SUCCESS and perform the tasks in that area if the error level passed back from the ASNA program is 0.

Note: The echo specified in each of the two areas instructs the batch program to write the trailing text to the screen, overriding the previous command to turn echo off.

For more information about how to write batch programs using errorlevel, see Microsoft’s MS DOS documentation.