From: Rowles, Steve CIV G25 <[log in to unmask]>
Date: Thursday, 30 March 2006 1:26
>The operation,
>DO WHILE (INDEX(STRING,'Connectivity').EQ.3
> & .OR.INDEX(STRING,'domain').EQ.6
> & .OR.INDEX(STRING,'domain').EQ.7)
>causes the program to fail because of logic contained in the do-while
>loop that is not able to specify the correct columns of data for those
>lines that have a four-digit line number (1000 or greater). If the
>"INDEX(STRING,'domain').EQ.7" test is not included, then those lines are
>simply not processed by the loop and the error is avoided. For example,
>it appears that the line,
> READ(STRING(13:NLEN-1),*) BLKSRC
>expects the period after "domain" to be in column 12, but with a
>four-digit line number, that period will be in column 13 (according to
>your input file sample), causing an error in the read, assuming that
>BLKSRC is an integer.
>In this situation, I tend to use unformatted reads as much as possible
>and without trying to specify the individual column location of each
>value. For example, you could isolate the part of STRING that contains
>the values that you want to read in and then read that portion of STRING
>with an unformatted read. Something like:
>position = index(STRING," f ",back=.true.)
>if(position.ne.0)then
> read(STRING(position+3:),*) BEG(1),BEG(2),BEG(3),END(1),END(2),END(3)
>endif
That won't help, because in most of the records given,
the letter "f" does not appear at all.
However, if the numeric data does not contain the letters 'e' or 'd'
[they appear to be all integers] then a reverse search for a letter
would offer the best outcome.
|