From:	SMTP%"RELAY-INFO-VAX@CRVAX.SRI.COM" 31-AUG-1993 12:03:38.04
To:	EVERHART
CC:	
Subj:	Re: LIB$DAY in DCL?

X-Newsgroups: comp.os.vms
From: laurel@netcom.com (Laurel Edgecomb)
Subject: Re: LIB$DAY in DCL?
Message-Id: <laurelCCLBKE.H07@netcom.com>
Organization: Northgate Equestrian Center, Walnut Creek, CA
X-Newsreader: TIN [version 1.1 PL8]
Date: Mon, 30 Aug 1993 20:57:49 GMT
Lines: 88
To: Info-VAX@kl.sri.com
X-Gateway-Source-Info: USENET

In article <267@mccoy.dbaccess.com>, steve@dbaccess.com (Steve Suttles)
writes...
 
> Very good.  Now does anyone have the algorithm for computing the date of
> Easter (or better yet, the location of a collection of this stuff?  I'm
> often in need of it and have to reconstruct it cuz I never wrote it down
> when I had it...

This is what I have used to get easter:

	    PROGRAM EASTER
	    IMPLICIT NONE

	    INCLUDE '($SYSSRVNAM)/NOLIST'
	    INCLUDE '(LIB$ROUTINES)/NOLIST'	    
	    INCLUDE '($LIBDTDEF)/NOLIST'

	    INTEGER*4	    Status

	    STRUCTURE /NUMTIM_ARRAY/	    ! NUMTIM Structure
		UNION 
		MAP
		    INTEGER*2 YEAR,MONTH,DAY,HOUR,MINUTE,SECOND,HUNDREDTH
		END MAP
		MAP
		    Character*14 ALL
		END MAP
		END UNION
		END STRUCTURE    !NUMTIM_ARRAY

	    CHARACTER*11	Easter_Date_String
	    RECORD /NUMTIM_ARRAY/ Easter_Date_Array	  ! Easter date NUMTIM Array
	    REAL*8		Easter_Quadword
	    !
	    ! Easter Computation Variables
	    !
	    INTEGER*4		EA
	    INTEGER*4		EB
	    INTEGER*4		EC
	    INTEGER*4		ED
	    INTEGER*4		EE
	    INTEGER*4		EF
	    INTEGER*4		EG
	    INTEGER*4		EH
	    INTEGER*4		EI
	    INTEGER*4		EK
	    INTEGER*4		EL
	    INTEGER*4		EM

	    !
	    ! Get Vectime of today
	    !
	    status = sys$numtim( Easter_Date_Array, %val(0) )
	    If (IAND(Status,1) .EQ. 0) Call Exit(Status)

	    !
	    ! Compute VECTIM of Easter for same year
	    !
	    EA = Mod(Easter_Date_Array.Year, 19)
	    EB = Easter_Date_Array.Year/100
	    EC = Mod(Easter_Date_Array.Year, 100)
	    ED = EB / 4
	    EE = Mod( EB, 4 )
	    EF = (EB+8)/25
	    EG = (EB - EF + 1) / 3
	    EH = Mod( 19*EA + EB - ED - EG + 15, 30 )
	    EI = EC / 4
	    EK = MOD(EC,4)
	    EL = MOD(32+2*EE+2*EI-EH-EK,7)
	    EM = (EA+11*EH+22*EL)/451
	    Easter_Date_Array.Month = (EH+EL-7*EM+114) / 31
	    Easter_Date_Array.Day   = Mod(EH+EL-7*EM+114, 31) + 1

	    !
	    ! Convert vector to quadword then string
	    !
	    status = lib$cvt_vectim( Easter_Date_Array, Easter_Quadword )
	    If (IAND(Status,1) .EQ. 0) Call Exit(Status)
	    status = lib$format_date_time (Easter_Date_String, Easter_Quadword, %val(0), %val(0), LIB$M_DATE_FIELDS)
	    If (IAND(Status,1) .EQ. 0) Call Exit(Status)

	    !
	    ! Output Easter as string
	    !
	    type *, 'Easter is ' // Easter_Date_String

	    END


