List-directed internal Read

List-directed internal Read

Need Help with "Read" statement

I can't seem to read buffer into IVAL

Trying to read buffer into array as follows:

The buffer(100) array contains the following, followed by 'crlf' '0,,,-12075,-85,0,102,-10272,1235'
IN_LEN = 8

---code:---
DO I = 1,100
IF(BUFFER(I:I).EQ.',') THEN
BUFFER(I:I) = ' '
IF(BUFFER(I+1:I+1) .EQ. ',') THEN
BUFFER(I+1:I+1) = '0' ! add 0
ENDIF
ENDIF
IF(BUFFER(I:I).EQ.';') BUFFER(I:I) = ' '
IF(BUFFER(I:I).EQ.CHAR(10)) BUFFER(I:I) = ' '
IF(BUFFER(I:I).EQ.CHAR(13)) THEN
BUFFER(I:I) = ' '
ICNT = I
ENDIF
ENDDO
DO I = ICNT, 100
BUFFER(I:I) = ' ' ! space to end of buffer
ENDDO

CONTINUE

READ(BUFFER,'(I1,I6)'),CODE,(IVAL(I), I=1,IN_LEN)
DO I = 1, IN_LEN
VAL(I) = FLOAT(IVAL(I))/1000.0
ENDDO

---end code:---

Any help will be helpful

james.montgomery2@lmco.com

Jim Monty

1 envío / 0 nuevos
Para obtener más información sobre las optimizaciones del compilador, consulte el aviso sobre la optimización.