[U2] [UV] Obtaining a file creation date and time without locking it

2011-06-02 Thread Jacques G.

Hello,

Currently I have code that does something like this:

EQU TM.LIMIT TO 3 ;* File useable if created less than TM.LIMIT seconds ago.


OPENSEQ PATH.HOUSE:ipcs.txt TO F.IPCS ELSE RETURN
STATUS STAT FROM F.IPCS THEN
   CLOSESEQ F.IPCS
   IPCS.TM = STAT15
   IPCS.DT = STAT16
   SEC.PASSED = (DATE() - IPCS.DT) * 86400
   SEC.PASSED += (TIME() - IPCS.TM)
   IF SEC.PASSED  TM.LIMIT THEN RETURN ;* Too old can't use it
END

The problem with this approach, is that in order to query the file's internal 
date and time, I have to do an OPENSEQ which locks the file.   This means that 
another process that may need to perform the same check has to wait for the 
lock 
to be released.

Any way to open the file in a ReadOnly mode in UV so that It won't get locked ?

Jacques

___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] [UV] Obtaining a file creation date and time without locking it

2011-06-02 Thread Sammartino, Richard
Someone posted a program to do this a couple of years ago.  I can post my 
version if needed.

Rich

Richard Sammartino
Systems Analyst
School District of Philadelphia
440 N Broad Street
Philadelphia, PA  19130
Phone (215) 400-5086
Fax (215) 400-4411

- Original Message -
From: Jacques G. jacque...@yahoo.com
To: U2 Users List u2-users@listserver.u2ug.org
Sent: Thursday, June 2, 2011 1:50:03 PM
Subject: [U2] [UV] Obtaining a file creation date and time without locking it


Hello,

Currently I have code that does something like this:

EQU TM.LIMIT TO 3 ;* File useable if created less than TM.LIMIT seconds ago.


OPENSEQ PATH.HOUSE:ipcs.txt TO F.IPCS ELSE RETURN
STATUS STAT FROM F.IPCS THEN
   CLOSESEQ F.IPCS
   IPCS.TM = STAT15
   IPCS.DT = STAT16
   SEC.PASSED = (DATE() - IPCS.DT) * 86400
   SEC.PASSED += (TIME() - IPCS.TM)
   IF SEC.PASSED  TM.LIMIT THEN RETURN ;* Too old can't use it
END

The problem with this approach, is that in order to query the file's internal 
date and time, I have to do an OPENSEQ which locks the file.   This means that 
another process that may need to perform the same check has to wait for the 
lock 
to be released.

Any way to open the file in a ReadOnly mode in UV so that It won't get locked ?

Jacques

___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users
___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] [UV] Obtaining a file creation date and time without locking it

2011-06-02 Thread Steve Romanow
On Thu, Jun 2, 2011 at 4:30 PM, Sammartino, Richard
rsamm...@philasd.org wrote:
 Someone posted a program to do this a couple of years ago.  I can post my 
 version if needed.

 Rich

 Richard Sammartino
 Systems Analyst
 School District of Philadelphia
 440 N Broad Street
 Philadelphia, PA  19130
 Phone (215) 400-5086
 Fax (215) 400-4411

 - Original Message -
 From: Jacques G. jacque...@yahoo.com
 To: U2 Users List u2-users@listserver.u2ug.org
 Sent: Thursday, June 2, 2011 1:50:03 PM
 Subject: [U2] [UV] Obtaining a file creation date and time without locking it


 Hello,

 Currently I have code that does something like this:

 EQU TM.LIMIT TO 3 ;* File useable if created less than TM.LIMIT seconds ago.


 OPENSEQ PATH.HOUSE:ipcs.txt TO F.IPCS ELSE RETURN
 STATUS STAT FROM F.IPCS THEN
   CLOSESEQ F.IPCS
   IPCS.TM = STAT15
   IPCS.DT = STAT16
   SEC.PASSED = (DATE() - IPCS.DT) * 86400
   SEC.PASSED += (TIME() - IPCS.TM)
   IF SEC.PASSED  TM.LIMIT THEN RETURN ;* Too old can't use it
 END

 The problem with this approach, is that in order to query the file's internal
 date and time, I have to do an OPENSEQ which locks the file.   This means that
 another process that may need to perform the same check has to wait for the 
 lock
 to be released.

 Any way to open the file in a ReadOnly mode in UV so that It won't get locked 
 ?

 Jacques

 ___
 U2-Users mailing list
 U2-Users@listserver.u2ug.org
 http://listserver.u2ug.org/mailman/listinfo/u2-users
 ___
 U2-Users mailing list
 U2-Users@listserver.u2ug.org
 http://listserver.u2ug.org/mailman/listinfo/u2-users


I would just do an EXECUTE to a scripting language and parse the results.

An ls -l with some awk will make quick work of it.

Here is a thread that describes ways to do it in python.
http://stackoverflow.com/questions/237079/how-to-get-file-creation-modification-date-times-in-python

PCPERFORM \python -c import os; print os.stat('test.xml').st_mtime\
CAPTURING OUTPUT will come back with the modification time in epoch
time.
___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] [UV] Obtaining a file creation date and time without locking it

2011-06-02 Thread Boydell, Stuart
Have you had a look at the openpath statement? That shouldn't lock it AFAIK.

   openpath path.house:ipcs.txt to f.ipcs then status stat from f.ipcs
   
Stuart

-Original Message-
From: u2-users-boun...@listserver.u2ug.org 
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Jacques G.
Sent: Friday, 3 June 2011 03:50
To: U2 Users List
Subject: [U2] [UV] Obtaining a file creation date and time without locking it


Hello,

Currently I have code that does something like this:

EQU TM.LIMIT TO 3 ;* File useable if created less than TM.LIMIT seconds ago.


OPENSEQ PATH.HOUSE:ipcs.txt TO F.IPCS ELSE RETURN STATUS STAT FROM F.IPCS THEN
   CLOSESEQ F.IPCS
   IPCS.TM = STAT15
   IPCS.DT = STAT16
   SEC.PASSED = (DATE() - IPCS.DT) * 86400
   SEC.PASSED += (TIME() - IPCS.TM)
   IF SEC.PASSED  TM.LIMIT THEN RETURN ;* Too old can't use it END

The problem with this approach, is that in order to query the file's internal 
date and time, I have to do an OPENSEQ which locks the file.   This means that 
another process that may need to perform the same check has to wait for the 
lock to be released.

Any way to open the file in a ReadOnly mode in UV so that It won't get locked ?

Jacques

___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users



___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users