Rapid as in lighting quick. If a file comes in at 5:59:59 pm, the warehouse wants me to turn the file into a sales order and get it to them for picking by 6:00:00 pm. That's a bit of an exaggeration but not much.
Also, I forgot to mention that the application that is putting files in the directory is external and I have no way of changing it. I figured out that I can move the fuser command outside of the loop and use the * wildcard character. This way I can build an array of files that are in use and locate the file from the ls command in the array and if there consider it inuse. Much much faster than executing through each iteration of the loop. Gotta love the wildcard characters. Thanks to all who took time out of their day to help me. Scott -------------- Original message -------------- From: "Anthony Youngman" <[EMAIL PROTECTED]> > How important is rapid response (and how do you define rapid? :-) > > > I presume you've got another outer loop round this lot - if not you can > create one. Get your ls command to return the file size, and save the > old output. > > Now, each time through the inner loop, you compare filesize against the > filesize from the previous outer loop, and only process if it hasn't > changed. At the end of the inner loop, save the output to compare > against next time through the loop. > > If you've got a minute's gap between outer loops, it could take up to > two minutes to get the file processed - worse case is loop 1 catches it > being copied, loop 2 doesn't process because the file size has changed, > and it only gets processed third time around. > > Cheers, > Wol > > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Sent: 07 June 2007 14:48 > To: u2-Users > Subject: [U2] [UV] Efficient way of determining if item is inuse > > 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/ > ------- > u2-users mailing list > u2-users@listserver.u2ug.org > To unsubscribe please visit http://listserver.u2ug.org/ ------- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/