- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - OpenVMS
- >
- Re: FTP error handling
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-01-2010 02:57 AM
тАО09-01-2010 02:57 AM
Using OpenVMS V7.3-2 I have a batch program that creates and submits an ftp process to copy a file from server a to server b using tcpip. Occasionally, the ftp fails due to network error, access denied, etc. When there is an error like:
%TCPIP-E-FTP_NETERR, I/O error on network device
-TCPIP-W-EAI_AGAIN, temporary failure
The user wants to get emailed to notify him that the FTP has not completed successfully.My problem is that the status code that the FTP process returns to the parent program is the same whether the FTP is successful or not - This is the status code %X00030001. How can I code this so that the parent program will execute an error routine if there is an FTP error?
Thanks !
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-01-2010 03:18 AM
тАО09-01-2010 03:18 AM
SolutionOne way would be to look for a successful string and then alert if it isn't present.
If you do a PUT and the link breaks then the file will be left overhanging.
Try:
PUT PAT.DAT PAT.TMP
RENAME PAT.TMP PAT.DAT
then check for the success string for a RENAME. For my local system the string is:
250 File
So:
$ SEARCH
$ STATUS := '$STATUS'
$ IF STATUS .EQ. %X08D78053
$ THEN
$ SUCCESS = 0
$ ELSE
$ SUCCESS = 1
$ ENDIF
Is a pretty simple way of determining whether the FTP was successful.
HTH
Craig
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-01-2010 03:49 AM
тАО09-01-2010 03:49 AM
Re: FTP error handling
Thanks for your quick response. My understanding of your solution is that I search the batch log file for a successful FTP command like 250 CWD command successful or 226 Transfer complete and then write error code if the commands are not there. My problem is that the ftp process is within the batch command procedure and there is only one log file produced.
For example in batch1.com here are the following commands:
$set on
$@pdftp_script.com server1 "lcd ud1:[temp], cd """""\dwfiles""""",mput *.*,dir"
$ftp_exit_status=$status
$if ftp_exit_status .eqs. ??? goto x
(Last two lines I want to work but don't). Batch1.com writes to batch1.log so I cannot search it while it it being written to.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-01-2010 04:01 AM
тАО09-01-2010 04:01 AM
Re: FTP error handling
Another idea is to use a command file, say a.com, containing the ftp commands, the syntax ftp host /user /password, and test $status
$ type a.com
put zzz.txt
quit
and issue a
$ def/user sys$input a.com
$ ftp host/user=my_user/pass=my_pass
$ sh symb $status
I get
$STATUS == "%X17649AAA"
(which translates to
%TCPIP-E-FTP_LOGREJ, login request rejected
after a
$ set message sys$message:tcpip$msg.exe
$ exit %X17649AAA )
when I put a bad password,
and
$STATUS == %X17649A01
(which translates to
%TCPIP-S-FTP_EXIT, exit per user command )
with a succesfull FTP.
So, if you don't get this last status, there is a problem.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-01-2010 04:06 AM
тАО09-01-2010 04:06 AM
Re: FTP error handling
$@pdftp_script.com/out=tmpfile server1 "lcd ud1:[temp], cd """""\dwfiles""""",mput *.*,dir"
And then you can search tmpfile for the string you want. If you want the log of the script in the total log, you can use
$type tempfile
Don't forget to delete the tempfile after the search/type.
Fekko
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-01-2010 06:12 AM
тАО09-01-2010 06:12 AM
Re: FTP error handling
TCPIP SHOW VERSION
> I have a batch program that creates and
> submits an ftp process to copy a file from
> server a to server b using tcpip.
Is this job running on "server a" or "server
b" or somewhere else?
> [...] My problem is that the ftp process is
> within the batch command procedure [...]
So change that?
HELP SPAWN
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-01-2010 06:50 AM
тАО09-01-2010 06:50 AM
Re: FTP error handling
Craig
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-01-2010 08:13 AM
тАО09-01-2010 08:13 AM
Re: FTP error handling
Consider using the FTSO package on the OpenVMS Freeware. It's free, it's a little buggy and slightly arcane, it'll likely never appear on OpenVMS I64, but it'll do what you want here, and way more.
(Not to imply that FTSO is any more secure, nor any less ugly than ftp.)
http://decuslib.com/decus/freewarev70/ftso/
For DECnet, use the FTSV variant:
http://decuslib.com/decus/freewarev70/ftsv/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-01-2010 08:15 AM
тАО09-01-2010 08:15 AM
Re: FTP error handling
Get off that fence, Hoff! :-)
Craig
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-01-2010 02:23 PM
тАО09-01-2010 02:23 PM
Re: FTP error handling
Tracking errors can be tricky... first, a misconception:
> Batch1.com writes to batch1.log so I
> cannot search it while it it being
> written to.
Yes you can! Log files are shared read, and you can control the disk flush interval. Use SET OUTPUT_RATE to set the flush timer to some known value. After some event you're interested, wait that long, then SEARCH the log file.
$ PIPE TYPE/TAIL=
(I posted some code recently that uses this idea. See last few posts in http://forums11.itrc.hp.com/service/forums/questionanswer.do?threadId=1444100 ).
But that's not the best way to keep track of errors. FTP should be returning $STATUS correctly, you just have to save it somewhere.
Find the actual FTP command:
$ FTP... whatever
$ ftpstatus=$STATUS
if it's in a lower level procedure you can return it in a global symbol:
$ ftpstatus==$STATUS
or as the completion status for the procedure, like this:
$ EXIT F$INTEGER(ftpstatus).OR.%X10000000
(the OR will stop the EXIT command from displaying the error message).
If it's in a subprocess or pipe segment, return it via the job logical name table
to "send":
$ DEFINE/JOB/NOLOG FTPSTATUS "''ftpstatus'"
to "receive":
$ ftpstatus=F$INTEGER(F$TRNLNM("FTPSTATUS"))
If you can't get a useable status from the FTP command, try using COPY/FTP instead.