      SUBROUTINE LCLEAN (ILINE, OLINE, COMPRS )
      LOGICAL DEBUG, DEBUGL, DEBUGN, DEBUGO, DEBUGP, DEBUGI
      COMMON /DEBCOM/ DEBUG, DEBUGL, DEBUGN, DEBUGO, DEBUGP, DEBUGI
      LOGICAL COMPRS
      INTEGER LLENG, ILEN, OLEN
      CHARACTER*1 TAB, ASCII
      CHARACTER*(*) ILINE, OLINE
      CHARACTER*80 DUMMY
      CHARACTER*127 UPLINE, LONGST
      COMMON /ASCIIC/ ASCII( 0: 255)
      EQUIVALENCE ( TAB, ASCII(9))
*
      ILEN = LEN( ILINE)
      OLEN = LEN( OLINE)
      IF (DEBUG) THEN
        DUMMY =  ' LCLEAN: INPUT='//ILINE( 1: MIN( 20, ILEN) )
        CALL DEBUGR( DUMMY( 1: 40) )
      ENDIF
      DO 5 ILLENG = ILEN, 1, -1
         IF( ILINE( ILLENG: ILLENG).NE. ' ') GOTO 6 
  5   CONTINUE
      ILLENG = 0
  6   CONTINUE
      IF ( ILLENG .LT. 1 ) THEN
         OLINE(1: OLEN) = ' '
         RETURN
      ENDIF
      I = 0
* 
C??      OLINE( 1: OLEN) = UPLINE( ILINE( 1: ILLENG) )
      LONGST = UPLINE( ILINE( 1: ILLENG) )
      OLINE( 1: OLEN) = LONGST( 1: ILLENG)
 10   IF ( OLINE(1:1) .EQ. ' ') THEN
         OLINE(1: OLEN) = OLINE( 2: OLEN)
         I = I + 1
         GOTO 10
      ENDIF
15    I = INDEX(OLINE(1: OLEN),',')
      IF (I .GT. 0) THEN
         OLINE(I:I)=' '
         GO TO 15
      ENDIF
16    I = INDEX(OLINE(1: OLEN),';')
      IF (I .GT. 0) THEN
         OLINE(I:I)=' '
         GO TO 16
      ENDIF
17    I = INDEX(OLINE(1: OLEN),TAB)
      IF (I .GT. 0) THEN
          OLINE(I:I)=' '
          GO TO 17
      ENDIF
18    I = INDEX(OLINE(1: OLEN),'/')
      IF (I .GT. 0) THEN
         OLINE(I:I)=' '
         GO TO 18
      ENDIF
      IF ( COMPRS ) THEN
         IEND = MAX( 1, ILLENG)
         ISPACE = 0
         DO 30 I = 1, IEND-1
 29         IF ( OLINE(I:I+1) .EQ. '  ') THEN
               OLINE(I: OLEN) = OLINE(I+1: OLEN)
               ISPACE = ISPACE + 1
               IF (ISPACE+I .GT. IEND) GOTO 35
              GOTO 29
            ENDIF
  30     CONTINUE
  35     CONTINUE
      ENDIF
  50  CONTINUE
      IF (DEBUG) THEN
        DUMMY = ' LCLEAN: OUTPUT='//OLINE( 1: MIN( 20, OLEN) )
        CALL DEBUGR( DUMMY( 1: 40) )
      ENDIF
      RETURN
      END
