#20985 - 2002-05-01 12:27 AM
FTP Error Checking
|
kdub
Fresh Scripter
Registered: 2001-11-05
Posts: 22
Loc: Appleton, WI
|
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
|
|
Top
|
|
|
|
#20987 - 2002-05-21 11:13 AM
Re: FTP Error Checking
|
MCA
KiX Supporter
   
Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
|
Dear Rocco,
The results of $date will not be the same.
@monthno & @mdayno will return values without leading zero's.
@date has as format yyyy/mm/dd
So it isn't necessary to use all kind of additional variables to create the $date value. Our version is:
$date=SubStr(@date,6,2)+SubStr(@date,9,2)+SubStr(@date,1,4)
greetings.
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 2220 anonymous users online.
|
|
|