Let the process creating the file tell you when its don.  Write it as 
one name then change the name when the write is completed (bad psudocode 
below):

OPENSEQ '/tmp/somefile' to OUTFILE ELSE DO SOME STUFF

LOOP
WHILE NOT(DONE)
   WRITESEQ LINE ON OUTFILE
REPEAT

SH -C "mv /tmp/somefile /tmp/somefile.done"


[EMAIL PROTECTED] wrote:
> Hi all,
>
> UV10.1.8 (PICK FORMAT)
> HPUX 11
>  
> I  am writing a routine that monitors/imports files from a particular 
> directory.   It is important for me to not begin processing a file that is 
> not finished being transferred.  What I am trying now is using the fuser 
> command and boy is it dog slow.  My code is similar to the following
>  
> COMMAND = SH C ls lrt indir
> EXECUTE COMMAND CAPTURING LINES
> LOOP
>     REMOVE LINE FROM LINES SETTING MORE
> WHILE MORE DO
>      FNAME = EREPLACE(TRIM(LINE), ,@AM)
>      FNAME = FNAME<9>
>      COMMAND = SH C /usr/sbin/fuser indir/ : FNAME : 
>      EXECUTE COMMAND CAPTURING RESULTS
>      RESULTS = TRIM(FIELD(RESULTS<1>,:,2))
>       INUSE = 0
>       IF RESULTS #  THEN
>            INUSE = 1
>       END
> REPEAT
>
> Can anyone give me a better (faster) way of making sure that a file is not in 
> use?  
>
> Thanks in advance,
>
> Scott
> -------
> u2-users mailing list
> u2-users@listserver.u2ug.org
> To unsubscribe please visit http://listserver.u2ug.org/
>
>   

-- 
------------------------------------------------------------------------
Jeff Schasny - Denver, Co, USA
jschasnyATgmailDOTcom
------------------------------------------------------------------------
-------
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to