Operating System - OpenVMS
1753695 Members
6170 Online
108799 Solutions
New Discussion юеВ

Checking for errors within a VMS batch job

 
SOLVED
Go to solution
Jorge Cocomess
Super Advisor

Checking for errors within a VMS batch job

Greetings,

I have this FTP batch job running on my VMS server. The batch job is written to do just that. However, I would like to insert an error check point incase the file was locked from uploading from another server. I am not sure how to do this. I am welcome for any suggestions to this subject.

Thank you in advance.

Jorge
11 REPLIES 11
Ian Miller.
Honored Contributor

Re: Checking for errors within a VMS batch job

If you are using the HP TCPIP Services for OpenVMS product then using the COPY/FTP command should return a error to your DCL process if the ftp transfer fails.

$ COPY/FTP ....
$ IF .NOT. $STATUS THEN ....
____________________
Purely Personal Opinion
Art Wiens
Respected Contributor
Solution

Re: Checking for errors within a VMS batch job

$! Files arriving are via Decnet COPY. A race condition can exist when the file hasn't
$! been fully copied and this procedure "finds it". Test - if we can't OPEN it, we can't FTP it.
$ OPEN /READ /WRITE /ERROR=LOCKED_FILE FILE 'FILE_TO_SEND'
$ CLOSE FILE
$ GOTO ACCESS_OK

Works for me,
Art
Daniel Fernandez Illan
Trusted Contributor

Re: Checking for errors within a VMS batch job

Hi Jorge
For a similar question I use a test for locked status of file. The command waits until target file is unlocked and after executes ftp.

$set noon
$fil="target_file"
$do:
$!Check if file is locked or opened
$att=f$file_attributes("''fil'","eof")
$if $status .eqs. "%X00000800" !File open
$then
$ wait 00:03
$ goto do
$endif
$ftp
....

Saludos.
Daniel.
Peter Barkas
Regular Advisor

Re: Checking for errors within a VMS batch job

A technique that I have used in the past is for the sender to copy the file with a file type dedicated to 'files being copied' perhaps .tmp and then to rename the file after the copy is complete.
John Abbott_2
Esteemed Contributor

Re: Checking for errors within a VMS batch job

Hi Jorge

We have a mixture of ftp jobs, not all vms 2 vms, other o/s involved so..

I'd recommend that the application/job that sends the file(s) sends a "completed" 1 block file afterwards and that you check for the presence of this file.

Using this method ensures that the file transfer has completed (one or more files) and that you have all the data. You could end up with a situation where the file transfers dies part way through due to unexpected error (network, sending sever fails, diskquota exceeded etc) you could end up processing a partial copied file.

Your dcl code would just check for the completed file, continue if present or wait and loop around a number of times if not present (i.e. consider giving up waiting after so many loops).

John.
Don't do what Donny Dont does
Wim Van den Wyngaert
Honored Contributor

Re: Checking for errors within a VMS batch job

I would keep a log of what FTP said. After the FTP read it, parse it and compare it with a good ftp. Error as soon as something is missing or given extra.

Wim
Wim
Jorge Cocomess
Super Advisor

Re: Checking for errors within a VMS batch job

Hi,

The file being generated on the Wintel server and FTPed down to the VMS server at a scheduled time. From the VMS server I will check for this file and FTP up to our client FTP site. The reason I like to do the error checking due to the repeat of this FTP process every 15 minutes interval.

I will update my FTP batch job and post it online for your review. Please review it and give me your suggestion.

Thank you in advance.

Jorge
Ian Miller.
Honored Contributor

Re: Checking for errors within a VMS batch job

You may find FTSO of interest - its' free
http://h71000.www7.hp.com/freeware/freeware70/ftso/
____________________
Purely Personal Opinion
Jorge Cocomess
Super Advisor

Re: Checking for errors within a VMS batch job

Ian,

Thanks for the link. By the way, how do you use these programs? There was a readme file but nothing for installation intructions.

J