Fortran Program samp1.f

Highlighted lines are those that are date sensitive. Date sensitivity does not necessarily mean that modifications are needed. It depends on the remediation method used. The following color chart indicates a modification is required if the associated remediation method is used.

orange - expansion

green - windowing

blue - compression

When a line is highlighted with more than one color, it means that if either of the associated remediation methods are used, modifications to the line will be required. Thus, for example,
    read(date1,'(3i2)')m1,d1,y1
indicates that changes are necessary to the line if either expansion or compression are used.


C**           Program samp1.f
C
C Samp1.f reads in 4 lines of data consisting 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 Organization) 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**
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