i have created the script to calculate days between year/month/day
fcreate receives the integer date of the create of a file and in the end
the variable days has the days old the file is.
the sl on my system is 1084 days old. ( we have not updated to 5.5)
i have tested this on only two files but if anyone sees a problem please
let me know.
if the file is old there are a lot of
*** EXPRESSION FALSE: COMMANDS IGNORED UNTIL MATCHING ELSEIF/ELSE
/ENDIF
*** RESUME EXECUTION OF COMMANDS
*** EXPRESSION FALSE: COMMANDS IGNORED UNTIL MATCHING ELSEIF/ELSE
/ENDIF
records output to the stream listing.
!setvar tyr hpyear
!if tyr<50 then
! setvar tyr tyr+2000
!else
! setvar tyr tyr+1900
!endif
!setvar tmo hpmonth
!setvar tdate hpdate
!setvar fcreate finfo("sl.pub.sys",-6)
!setvar fcryear fcreate/10000
!setvar fcrmonth fcreate/100 mod 100
!setvar fcrdate fcreate mod 100
!while tyr > fcryear do
! setvar tyr tyr-1
! setvar tmo tmo +12
!endwhile
! setvar days tdate - fcrdate
!while tmo > fcrmonth do
! setvar tmo tmo -1
! if tmo mod 12 = 1
! setvar days days +31
! endif
! if tmo mod 12 = 2
! if (tyr +tmo/12) mod 4 = 0
! setvar days days +29
! else
! setvar days days +28
! endif
! endif
! if tmo mod 12 = 3
! setvar days days +31
! endif
! if tmo mod 12 = 4
! setvar days days +30
! endif
! if tmo mod 12 = 5
! setvar days days +31
! endif
! if tmo mod 12 = 6
! setvar days days +30
! endif
! if tmo mod 12 = 7
! setvar days days +31
! endif
! if tmo mod 12 = 8
! setvar days days +31
! endif
! if tmo mod 12 = 9
! setvar days days +30
! endif
! if tmo mod 12 = 10
! setvar days days +31
! endif
! if tmo mod 12 = 11
! setvar days days +30
! endif
! if tmo mod 12 = 0
! setvar days days +31
! endif
!showvar days
!endwhile
> -----Original Message-----
> From: Stigers, Greg ~ AND [SMTP:[log in to unmask]]
> Sent: Tuesday, July 14, 1998 12:26 PM
> To: [log in to unmask]
> Subject: Re: days since creation of file
>
> 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.
|