The attached command file, FILEAGE, can do MOST of that. The command file
has NOT been tested extensively and may not provide 100% accuracy for very
old files. However if one wants to periodically generate a list of files
that are older than 'x' number of days then this should do the job.
The command can be simplified if the '_todays_age' variable was 'preset' at
logon time.
Regards
Paul H. Christidis
-------------------------<Start Cut *+1
parm fname="?", agevar="_files_age"
if "!fname" = "?" then
echo ![chr(7)]
echo Usage ![finfo(hpfile,"fname")] filename [agevar]
echo
echo Filename - The file whose age, in terms of days, is to be
echo calculated.
echo
echo agevar - CI variable that will hold the file's age. If
echo not supplied the default of '_files_age' is used.
echo ![chr(7)]
return
endif
setvar _todays_age (hpyyyy*36525)/100 + (hpmonth*304)/10 + hpdate
setvar _cre_date finfo("!fname","intcreated")
setvar _fcreate_age ((_cre_date/10000)*36525)/100 &
+(((_cre_date mod 10000)/100)*304)/10 &
+ _cre_date mod 100
setvar !agevar _todays_age - _fcreate_age
echo "!fname" is ![!agevar] day(s) old
--------------------------<End Cut *-1
______________________________ Reply Separator
_________________________________
Subject: Re: days since creation of file
Author: [log in to unmask] at mime
Date: 07/14/98 11:25
The original poster, Larry Simonsen, replied to my programmatic approach
off list, more or less indicating that he wanted an MPE approach. I have
been thinking about this, and wondering if there really is a good way to
use MPE to do this. I would think, assuming files could be years old,
but for a latter month in a previous year, if there is a good way to
parse the years and months. I think it would be a lot of command file
programming, but would be interested to see if someone can prove me
wrong.
As for me, I have considered writing a DAYSAGO COBOL utility that would
take a single numeric argument for the number of days ago, and created a
environment variable for that date, suitable for use in STOREs or
SELEQs. I might want to get fancy, and allow for the three letter
abbreviation for day of week, to return, say, last MONday's date. But if
I could do this in Pure MPE, that would be neat.
> -----Original Message-----
> From: Joseph Rosenblatt [SMTP:[log in to unmask]]
> Sent: Tuesday, July 14, 1998 12:28 PM
> To: [log in to unmask]
> Subject: Re: [HP3000-L] days since creation of file
>
> FINFO function -6 returns a date in yyyymmdd format.
>
> :setvar creation finfo ("yr1.pub.sys",-6)
> :showvar creation
> CREATION = 19980528
>
> Once you have that you can do whatever calculations you'd like. You
> can
> subtract the variable from the System variables for dates.
> (HPYYY+HPMONTH +HPDATE) etc.
|