home *** CD-ROM | disk | FTP | other *** search
/ ftp.update.uu.se / ftp.update.uu.se.2014.03.zip / ftp.update.uu.se / pub / rainbow / msdos / decus / RB101 / strip.for < prev    next >
Text File  |  1995-05-19  |  3KB  |  153 lines

  1. $STORAGE: 2
  2. $NOFLOATCALLS
  3. c-----------------------------------------------------------------------
  4. c
  5. c    Strip Daily Appointment subroutine
  6. c
  7. c    part of GLENN EVERHART'S MODS TO DTC program
  8. c
  9. c    Input: 
  10. c       line - 72 characters;  Format: P [mmddyy]
  11. c
  12. c    Output:
  13. c        Strips old appointments (before date) from dtc.dat
  14. c    and builds new dtc.dat.
  15. c
  16. c-----------------------------------------------------------------------
  17. c
  18.  
  19.     SUBROUTINE strip(line)
  20.  
  21. c
  22. c    Declarations:
  23. c
  24.  
  25.     character line(1)        
  26. c     input line
  27.     CHARACTER*2 TMP2
  28.     character temp(2)        
  29.     EQUIVALENCE(TMP2,TEMP(1))
  30. c     temporary string converting array
  31.     character appoin(60)        
  32. c     appointment string
  33.     character esc        
  34. c     escape character
  35.     integer    id        
  36. c     Julian Day
  37.     integer im        
  38. c     Julian Month
  39.     integer iye        
  40. c     Julian Year
  41.     integer rdspfg          
  42. c   flag to reverse sense of display of time
  43.     integer ctlfg           
  44. c   misc control flags here
  45.     common/ctls/rdspfg,ctlfg
  46.     character fname(60)
  47.     CHARACTER*20 FNAM60
  48.     EQUIVALENCE (FNAME(1),FNAM60)
  49.     integer fnsz
  50.     common/fn/fnsz,fname
  51.  
  52. c
  53. c    Initialize:
  54. c
  55.  
  56.     iterm = 0        
  57. c     Output terminal unit number
  58.     esc = 27        
  59. c     Escape character
  60.     call idate(im,id,iye)    
  61. c     initialize to today's date
  62.  
  63.  
  64. c
  65. c        Parse that line
  66. c
  67.  
  68. c
  69. c        Was there a P on the front?  If so, trim it off:
  70. c
  71.  
  72.     IDMX=0
  73.     If ( line(1) .eq. 'P' .or.line(1).eq.'p') then
  74.         Do 1 i=1,70
  75.         line(i) = line(i+2)
  76. 1        Continue
  77.  
  78.     End If
  79.  
  80.  
  81. c
  82. c        If the date was specified in command line then
  83. c        set id, im and iye to the right values:
  84. c
  85.     CALL DATMUN(LINE)
  86.     Do 22 i=1,6
  87.         IDL=I
  88.         If ( ( line(i) .gt. '9' ) .or. ( line(i) .lt. '0' ) ) goto 33
  89. 22    Continue
  90.  
  91. c    Six numbers in a row, so decode into numeric date:
  92.  
  93.         temp(1) = line(1)
  94.         temp(2) = line(2)
  95.     read(tmp2,2)im
  96. c        decode ( 2 , 2 , temp ) im
  97.         temp(1) = line(3)
  98.         temp(2) = line(4)
  99.     read(tmp2,2)id
  100. c        decode ( 2 , 2 , temp ) id
  101.         temp(1) = line(5)
  102.         temp(2) = line(6)
  103.     read(tmp2,2)iye
  104. c        decode ( 2 , 2 , temp ) iye
  105. 2    Format(i2)
  106.  
  107. c
  108. c        Now discard the date part from line string:
  109. c
  110.  
  111.         Do 3 i=1,63
  112.         line(i) = line(i+7)
  113. 3        continue
  114.     GOTO 3307
  115. 33    continue
  116. C GOT A DELIMITER NOT A NUMERIC IN 1ST 6 COLS SO MAKE THAT THE START OF LINE
  117. C BY CHOPPING OFF ALL THAT'S EARLIER
  118.     IF(IDL.LE.0.OR.IDL.GT.6)GOTO 3307
  119.     DO 3308 I=1,63
  120.         LINE(I)=LINE(I+IDL)
  121. 3308    CONTINUE
  122. 3307    CONTINUE
  123.     KHSH=ID+32*(IM+12*(IYE-81))
  124. C ADD CLOSE TO GUARANTEE NO FAILURES...
  125.                 CLOSE(1)
  126.     Open (1, file=FNAM60,status='OLD',form='FORMATTED')
  127.         close(2)
  128.     OPEN(2,FILE=FNAM60,STATUS='NEW',FORM='FORMATTED')
  129.  
  130. 100    continue    
  131. c     loop back up here to continue reading and
  132.             
  133. c     processing input file:
  134.  
  135.  
  136.     read(1,200,end=400) ihy,ihm,ihd,iht,(line(k),k=1,60)
  137. 200    format(3i2,i3,60a1)
  138.     LHSH=IHD+32*(IHM+12*(IHY-81))
  139.     IF(LHSH.LT.KHSH)GOTO 100
  140.     WRITE(2,200)IHY,IHM,IHD,IHT,(LINE(K),K=1,60)
  141.     goto 100
  142.  
  143. 400    continue    
  144. c  no more appointments left in file.
  145.     close(1)
  146.     CLOSE(2)
  147.  
  148.     return
  149.     end
  150.  
  151.  
  152.