From: Lewis Balfour <[log in to unmask]>
Date: Wednesday, 29 March 2006 2:23
>I am using the INDEX intrisic function on a file inside a DO WHILE loop to dictate the operations
performed on the file. This bit of code forks fine:
>
>DO WHILE (INDEX(STRING,'Connectivity').EQ.3
> & .OR.INDEX(STRING,'domain').EQ.6)
>
>On lines in my file like this:
>
># Connectivity for domain.16
>967 domain.16 -j k-i f 33 1 1 1 122 1
>
>But some the lines in the file are like this;
>
># Connectivity for domain.17
>1043 domain.17 j k-i f 1 1 1 12 122 1
>
>So I have changed my code as follows:
>
>DO WHILE (INDEX(STRING,'Connectivity').EQ.3
> & .OR.INDEX(STRING,'domain').EQ.6
> & .OR.INDEX(STRING,'domain').EQ.7)
One reference to INDEX should be sufficient to search for 'domain':
INDEX(STRING, 'domain') .GT. 0
and the DO becomes:
DO WHILE ((STRING(3: 14) .EQ. 'Connectivity') .OR.
& INDEX(STRING, 'domain') .GT. 0) )
|