Page 1 of 1 1
Topic Options
#20985 - 2002-05-01 12:27 AM FTP Error Checking
kdub Offline
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
#20986 - 2002-05-01 03:02 PM Re: FTP Error Checking
Rocco Capra Offline
Hey THIS is FUN
*****

Registered: 2002-04-01
Posts: 380
Loc: Mansfield Ohio
In kix 4.02 there are macros for the month number and day number.

@monthno
@mdayno
@year

you could change this...
$mo = SubStr(@DATE,6,2)
$day = SubStr(@DATE,9,2)
$year = SubStr(@DATE,1,4)
$date = "$mo$day$year"

to this...
$date = "@monthno@mdayno@year"

Rocco

[ 01 May 2002, 15:03: Message edited by: Rocco Capra ]
_________________________
I Love this board!! -------------------- My DEV PC is running KIX 4.22 WINXP Pro

Top
#20987 - 2002-05-21 11:13 AM Re: FTP Error Checking
MCA Offline
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.
_________________________
email scripting@wanadoo.nl homepage scripting@wanadoo.nl | Links | Summary of Site Site KiXforms FAQ kixtart.org library collection mirror MCA | FAQ & UDF help file UDF kixtart.org library collection mirror MCA | mirror USA | mirror europe UDF scriptlogic library collection UDFs | mirror MCA

Top
#20988 - 2002-05-21 01:59 PM Re: FTP Error Checking
Rocco Capra Offline
Hey THIS is FUN
*****

Registered: 2002-04-01
Posts: 380
Loc: Mansfield Ohio
Well, ok, kdub didn't specify that he wanted 0's.

Here is what I do for the 0's...


IF @MONTHNO < 10
$MONTH = "0" + @MONTHNO
ELSE
$MONTH = @MONTHNO
ENDIF
IF @MDAYNO < 10
$DAY = "0" + @MDAYNO
ELSE
$DAY = @MDAYNO
ENDIF
$FILENAME = $MONTH + $DAY + "x86.exe"


Kinda bulky, but it gets the job done and I can understand what it is doing. I suppose as I get deaper into Kix I will use SubStr(). [Smile]

Rocco
_________________________
I Love this board!! -------------------- My DEV PC is running KIX 4.22 WINXP Pro

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 2220 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.062 seconds in which 0.035 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org