FTN,B,L
C
C     THIS PROGRAM VERIFIES THE OPERATION OF THE <MVC> AND <ICLC>
C     ROUTINES AND DEMONSTRATES THE CHARACTER HANDLING CAPABILITY
C     OF FORTRAN WHEN THESE ROUTINES ARE USED.  THIS PROGRAM
C     REMOVES IMBEDDED SPACES FROM A SENTENCE INPUT ON THE TTY
C     AND PRINTS IT BACK OUT.  THE SENTENCE INPUT MUST BE
C     TERMINATED BY A PERIOD (".").
C
      PROGRAM SPACE
      DIMENSION IBUF(36),LBUF(36)
   10 WRITE(2,30)
   30 FORMAT(/"ENTER A SENTENCE, TERMINATED BY A PERIOD (.)"/)
C
C     READ IN THE SENTENCE ON THE TTY INTO 'IBUF':
C
      READ(1,40) IBUF
   40 FORMAT(36A2)
C
C     REMOVE SPACES AND PACK INTO 'LBUF':
C
      DO 45 I=1,36
   45 LBUF(I)=20040B
      J=0
      DO 70 K=1,72
      I=K-1
      IF(ICLC(IBUF,I,56B,1,1)) 50,80,50
   50 IF(ICLC(IBUF,I,40B,1,1)) 60,70,60
   60 CALL MVC(IBUF,I,LBUF,J,1)
      J=J+1
   70 CONTINUE
C
C     NO PERIOD FOUND - ERROR:
C
      WRITE(2,75)
   75 FORMAT(//"*** ERROR - NO PERIOD FOUND ***"/)
      GOTO 10
C
C     PERIOD FOUND - OUTPUT THE SENTENCE:
C
   80 CALL MVC(56B,1,LBUF,J,1)
      LEN=J/2+1
   90 WRITE(2,40) (LBUF(I),I=1,LEN)
      GOTO 10
      END
      END$
