 SUBROUTINE from_excel (string)
! ... ..................................................................
 CHARACTER string*(*), tab, h_vec
 INTENT (INOUT) :: string
 LOGICAL :: ltest=.FALSE.
 ALLOCATABLE h_vec(:)
 string = ADJUSTL(string); leng = LEN_TRIM(string)
IF (ltest) print*,'_from_excel IN  string:_', trim(string) // '_'
 ipoint = 0; IF (INDEX(string(:leng), '.') > 0) ipoint = 1
 isemic = 0; IF (INDEX(string(:leng), ';') > 0) isemic = 1
 iamer = 1; IF (ipoint == 0 .OR. isemic > 0) iamer = 0
IF (ltest) print*,'_from_excel iAmer,', iamer
! ... Replacements
 ALLOCATE (h_vec(leng))
 h_vec = (/ (string(k:k), k=1, leng) /); tab = CHAR(9)
 SELECT CASE (iamer)
 CASE (0) ! ... De-tab and convert to Amer
 WHERE (h_vec == ',') h_vec = '.'
 WHERE (h_vec == tab) h_vec = ','
 WHERE (h_vec == ';') h_vec = ','
 CASE (1) ! ... De-tab
 WHERE (h_vec == tab) h_vec = ','
 END SELECT
 DO k=1, leng; string(k:k) = h_vec(k)
 END DO
 DEALLOCATE (h_vec)
IF (ltest) print*,'_from_excel OUT string:_', trim(string) // '_'
 RETURN
 END SUBROUTINE !END!

 SUBROUTINE vec_read (hwork, ndata, vector)
! ... Reads a vector and "converts" it to Amer .........................
 IMPLICIT DOUBLE PRECISION (a-h, o-z)
 CHARACTER hwork*(*)
 LOGICAL :: ltest=.FALSE.
 POINTER vector(:)
 CALL tempfile_F (itempfile, 'on')
 REWIND (itempfile)
 ndata = 1
 DO; READ (*, "(A)") hwork; IF (hwork(:3) == 'EOD') EXIT
    hwork = ADJUSTL(hwork); IF (LEN_TRIM(hwork) == 0) CYCLE
IF (ltest) print*,'_vec_read 11 hwork:_', trim(hwork) // '_'
    CALL from_excel (hwork)
    CALL suppress_blanks (hwork)
IF (ltest) print*,'_vec_read 22 hwork:_', trim(hwork) // '_'
    WRITE (itempfile, "(A)") TRIM(hwork)
    leng = LEN_TRIM(hwork)
    DO i=2, leng; IF (hwork(i:i) == ',') ndata = ndata + 1
    END DO
 END DO
 ALLOCATE (vector(ndata))
 REWIND (itempfile)
 READ (itempfile, *) vector
 CALL tempfile_F (itempfile, 'off')
 RETURN
 END SUBROUTINE !END!

 SUBROUTINE ivec_read (hwork, ndata, ivector)
! ... Reads an integer vector ..........................................
 IMPLICIT DOUBLE PRECISION (a-h, o-z)
 CHARACTER hwork*(*)
 LOGICAL :: ltest=.FALSE.
 POINTER ivector(:)
 CALL tempfile_F (itempfile, 'on')
 REWIND (itempfile)
 ndata = 1
 DO; READ (*, "(A)") hwork; IF (hwork(:3) == 'EOD') EXIT
    hwork = ADJUSTL(hwork); IF (LEN_TRIM(hwork) == 0) CYCLE
    CALL from_excel (hwork)
    CALL suppress_blanks (hwork)
IF (ltest) print*,'_ivec_read 11 hwork:_', trim(hwork)//'_'
    WRITE (itempfile, "(A)") TRIM(hwork)
    leng = LEN_TRIM(hwork)
    DO i=2, leng; IF (hwork(i:i) == ',') ndata = ndata + 1
    END DO
IF (ltest) print*,'_ivec_read 22 ndata,', ndata
 END DO
 ALLOCATE (ivector(ndata))
 REWIND (itempfile)
 READ (itempfile, *) ivector
 CALL tempfile_F (itempfile, 'off')
 RETURN
 END SUBROUTINE !END!

 SUBROUTINE suppress_blanks (string)
! ... ..................................................................
 CHARACTER string*(*)
 LOGICAL :: ltest=.FALSE.
 DO; ib = INDEX(TRIM(string), ' '); IF (ib == 0) EXIT
IF (ltest) print*,CHAR(13), '_suppress 22 Leng, string:', &
         len_trim(string), ' _'//trim(string)//'_'
    IF (string(ib-1:ib-1) /= ',') string(ib:ib) = ','
IF (ltest) print*,'_suppress 33 ib,', ib, CHAR(13), &
         '_suppress string(ib+1:ib+1):_', string(ib+1:ib+1)//'_'
    IF (string(ib:ib) == ' ') THEN; leng = LEN_TRIM(string)
IF (ltest) print*,'_suppress 44 leng, string:', leng, ' _'//trim(string)//'_'
       string(ib:leng-1) = string(ib+1:leng)
       string(leng:leng) = ' '
IF (ltest) print*,'_suppress 55 Lg, string:', len_trim(string), &
            ' _'//trim(string)//'_'
    END IF
IF (ltest) print*,'_suppress 66 Leng, string:', len_trim(string), &
         ' _'//trim(string)//'_'
 END DO
 RETURN
 END SUBROUTINE !END!
