I have some code that I wish to add to an existing script. The purpose of this is to notify our operations staff that an error is occurring during the FTP process. The $Notifycmd file will send a message to our operations console on the mainframe. I want the script to remain in this loop until action is taken - it will continue as soon as the file is available on the mainframe. I haven't tested yet - just looking for observations - things I may have overlooked or should take into account.

$MyRoot = 'e:\Test BizFiles'
$FTPScript = 'ftpscript.txt'
$LogPath = $MyRoot+'\LogFiles'
$mo = SubStr(@DATE,6,2)
$day = SubStr(@DATE,9,2)
$year = SubStr(@DATE,1,4)
$date = "$mo$day$year"
$FTPLog = "$date.txt"
$MyLog = "$LogPath\$FTPLog"
$SesLog = "$LogPath\session.txt"
$APDir = $MyRoot+'\APUtils'
$ScriptDir = $MyRoot+'\scripts'
$TempFTP = "ftp.tmp"
$Notifycmd = "e:\Test BizFiles\APUtils\command.cmd"
$Count = 0
$MyCommand = "e:\Test BizFiles\APUtils\biztkftp.cmd"

:FTP
Shell '%comspec% /c $MyCommand "'+$FTPScript+'" "'+$SesLog+'" "'+$APDir+'"'

Shell '%comspec% /c type "$SesLog"|find /i "450 Data set">$TempFTP'

If GetFileSize("TempFTP") = 0
Shell '%comspec% /c type "$SesLog">"$FTPLog"'
Else
If GetFileSize("$TempFTP") <> 0
$Count = $Count + 1
; Has 2 minutes elapsed?
If $count = 12
Shell '%comspec% /c $Notifycmd "c:\aputils\console HQEXCHANGE2" "The BizTalk FTP scipt is hung" "Page ECT Group Oncall Priority 1"'
EndIf
Del "$TempFTP"
Sleep 10
Goto FTP
Else
Del "$TempFTP"
EndIf
EndIf
Exit