1752613 Members
4208 Online
108788 Solutions
New Discussion юеВ

File Monitoring Service

 
SOLVED
Go to solution
Robert Cermack
New Member

File Monitoring Service

I'm trying to monitor the existence of a flat file resident on a Unix server from a VMS machine. Currently have a NFS mount giving visibility to the Unix box, but need to develop a VMS (detached?) service to watch for the appearance of the files on the Unix box so they can processed into a database on the VMS machine. I'm not a VMS programmer, so I'm looking for suggestions for available system services, library routines, freeware, etc... to help. Any suggestion ?????
7 REPLIES 7
Karl Rohwedder
Honored Contributor

Re: File Monitoring Service

A simple (but not very elegant) solution is just have a DIR/FTP in a loop and check the status. This is of course not useful, if you have to check very often...

regards Kalle
Volker Halle
Honored Contributor
Solution

Re: File Monitoring Service

Robert,

if I understand your references to 'NFS mount' correctly, you have the directory on the Unix box mounted via NFS from the OpenVMS system, so you could see the file from OpenVMS system with a $ DIRECTORY command ?

If so, you could use a simple DCL procedure using F$SEARCH to 'wait' for the appearance of the file and then start processing it:

$loop:
$ file = F$SEARCH("X.X")
$ IF file .nes. "" THEN $ GOTO process_file
$ WAIT 0:0:5
$ GOTO loop
$!
$process_file:
$ SHOW SYMB file

Volker.
Bojan Nemec
Honored Contributor

Re: File Monitoring Service

Robert,

I agree with Volker that this is the simplier way. You could submit such procedure in a batch queue to get a "detached" process (I put detached in quotes because this is not a real detached process).

If you want to go on the hard way, there is the VMS documentation:

http://h71000.www7.hp.com/doc/os82_index.html

For system services:
http://h71000.www7.hp.com/doc/82FINAL/4527/4527PRO.HTML
for library routines:
http://h71000.www7.hp.com/doc/82final/5932/5932PRO.HTML

probably you will need RMS:
http://h71000.www7.hp.com/doc/73final/6027/6027PRO.HTML

For the freeware look at:
http://h71000.www7.hp.com/openvms/freeware/index.html

Bojan
David B Sneddon
Honored Contributor

Re: File Monitoring Service

Robert,

A slight variation on Volker's procedure...
Depending on the size of the file, it may exist
but still be in the process of being written.
Try opening it for write access, if it fails
go back to waiting.

$loop:
$ file = F$SEARCH("X.X")
$ IF file .nes. "" THEN $ GOTO process_file
$wait_a_bit:
$ WAIT 0:0:5
$ GOTO loop
$!
$process_file:
$ close/nolog channel
$ open/read/write/error=wait_a_bit channel 'file'
$ close/nolog channel
$ SHOW SYMB file


Dave
Jan van den Ende
Honored Contributor

Re: File Monitoring Service

Robert,

I agree with David that you should check for the file being closed already.
However, I do not fully trust in NOT being able to write to a _UNIX_ file while it is open. Also, the chance exists that _YOUR_ test-OPEN interferes with the writing app.

Can you have/get any control over the applic that _WRITES_ the file?
My usual approach is to have the generating applic rename the file after closing.
Then checking for the renamed file results in a found file being fullt available for you.

Proost.

Have one on me.

jpe
Don't rust yours pelled jacker to fine doll missed aches.
Robert Cermack
New Member

Re: File Monitoring Service

Thanks to all for your responses. I'll probably work with the DCL (F$SEARCH) batch routine option first and investigate the more robust RMS solution later.
Robert Cermack
New Member

Re: File Monitoring Service

Closed. Thanks again.