University
of Delaware


Year 2000 Examples

Example 1: 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

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


Example 2: Fortran Program samp1fixedw.f - 2-digit Year Processing Using a Fixed Window with Pivot Year 1960

We modify the program, samp1.f, to include fixed window logic, producing samp1fixedw.f

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

Examples:



     The following examples give the correct answers 
assuming that 2-digit years >= 60 designate 1900 + the
year and 2-digit years < 60 designate 2000 + the year.
The fixed window covers the years 1960 to 
2059 inclusive. 

        Sally Smith
        010159
        Fred Smith
        010160

        Tom Younger
	010140
	Tom Older
	010124 

   Name 1:   
   Age 1 :   

   Name 2:   
   Age 2 :   
Submit the age/birthdate data to program samp1expand.f


Example 3: Fortran Program samp1slidew.f - 2-digit Year Processing Using a Sliding Window

This section for a sliding window is not operational. Work in progress.

We modify the program, samp1.f, to include sliding window logic, producing samp1slidew.f

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

Examples:



     The following examples give the correct answers 
assuming that 2-digit years >= pivot



 

        Sally Smith
        010159
        Fred Smith
        010160

        Tom Younger
	010140
	Tom Older
	010124 

   Name 1:   
   Age 1 :   

   Name 2:   
   Age 2 :   
Submit the age/birthdate data to program samp1expand.f


Example 4: Fortran Program samp1compress.f - 2-digit Year Processing Using a Hexidecimal Representation

This section that uses compression is not operational. Work in progress.

We modify the program, samp1.f, to include sliding window logic, producing samp1compress.f

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

Examples:



     The following examples give the correct answers 
assuming that 2-digit years >= pivot



 

        Sally Smith
        010159
        Fred Smith
        010160

        Tom Younger
	010140
	Tom Older
	010124 

   Name 1:   
   Age 1 :   

   Name 2:   
   Age 2 :   
Submit the age/birthdate data to program samp1expand.f


Example 5: Fortran Program samp1expand.f - 4-digit Year Processing

We modify the program, samp1.f, using 4 digit year variables in place of 2-digit years producing samp1expand.f

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

Examples:


        John Brown
        01011980
        Fred Smith
        01011990

        Tom Younger
	01012000
	Tom Older
	01011999 

   Name 1:   
   Age 1 :   

   Name 2:   
   Age 2 :   
Submit the age/birthdate data to proram samp1expand.f


Example 6: Fortran Program samp2.f - 2-digit Year Processing with Input from a File

We modify program samp1.f to produce the program samp2.f . Program samp2.f reads input from file file samp2in which contains the lines:

Bob Barker
011077
Tom Tyler
102088

Submit the age/birthdate data to progam samp2.f


Example 7: Fortran Program samp2expand.f (input from a file)

This program is in process

Submit the date and time to the getdate routine