Y2K Millennium Compliance - University of Delaware


Year 2000 Example Program

Fortran Program samp1.f - 2-digit Year Processing


C**           Program samp1.f
C
C Samp1.f reads in 4 lines of data consisiting of:
C
C    Name1
C    Birthdate1
C    Name2
C    Birthdate2
C
C
C where all entries are character strings and the birthdates are in
C date format:  MMDDYY.
C 
C Note that while it would be more efficient for the format of the 
C input data to be in ISO (International Standards Organizatin) date
C format, YYMMDD, the format used provides a more useful program for 
C illustrating problems associated with y2k remediation.
C
C Example:
C
C    John Smith
C    991201
C    Joe Public
C    981131
C
C The program compares the dates and computes which individual is
C older and prints the result with birthdates expressed in the
C format MM/DD/YY.
C
C**
	character*6 date1,date2,date1p,date2p
        character *20 name1,name2
	character*3 month(12)
	integer m1,m2,d1,d2,y1,y2
	data  month/'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
     1   'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'/
        read(*,'(a)')name1
	read (*,'(a)')date1 
        read(*,'(a)')name2
	read (*,'(a)')date2 
	read(date1,'(3i2)')m1,d1,y1
        read(date2,'(3i2)')m2,d2,y2
        date1p = date1(5:6)//date1(1:2)//date1(3:4)
        date2p = date2(5:6)//date2(1:2)//date2(3:4)
        if(date1p.eq.date2p)then
         print *, name1,' with birthdate: ', month(m1),' ',d1,', ',
     1    1900+y1
	 print *
	 print *, 'is the same age as'
	 print *
	 print *, name2,' with birthdate: ', month(m2),' ',d2,', ',
     1    1900+y2
        else if(date1p.lt.date2p)then
	 print *, name1,' with birthdate: ', month(m1),' ',d1,', ',
     1    1900+y1
	 print *
	 print *, 'is older than'
	 print *
	 print *, name2,' with birthdate: ', month(m2),' ',d2,', ',
     1    1900+y2
        else
	 print *, name1,' with birthdate: ', month(m1),' ',d1,', ',
     1    1900+y1
	 print *
	 print *, 'is younger than'
	 print *
         print *, name2,' with birthdate: ', month(m2),' ',d2,', ',
     1    1900+y2
        endif
	end

Enter two sets of names and birthdates using 2-digit years

Notice

Execution of the example program using this form is restricted to users at the University of Delaware. Attempts from outside the University of Delaware will result in an error message ("Forbidden").

This restriction applies to all example programs referenced in "Year 2000 Software Solutions.

The format for a birthdate is MMDDYY.

Examples:


     The following example, where John Older was born on December 25,
1980 and Fred Younger was born on November 8, 1998  will give the correct answer:

        John Older
        122580
        Fred Younger
        110898

     The following example, where John Older was born on January 1, 1998 
and Fred Younger was born on November 25, 2001 will give the wrong answer:

        John Older
	010198
	Fred Younger
	112501 


   Name 1:   
   Age 1 :   

   Name 2:   
   Age 2 :   
Submit the age/birthdate data to progam samp1.f