Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Fortran dynamic read statement 1

Status
Not open for further replies.

PKCHRIS

Programmer
Jun 15, 2009
2
US
Hi,

I am having some trouble understanding what exactly a line in fortran is referencing.

The line in question is:
Code:
READ(77,*,END=10) NVAR(NN),(VAR(NN,I),I=1,nVAR(NN))
The data file I am reading in looks something like this:
Code:
 1 1 
 0.5852977040 0.6642564540 0.2807423770
    18.3411 
    14.2399 
    79.7194
I know 77 is the file unit number. And I know END=10 is a goto statement if for some reason the file read fails. I also know the first parameter will assign the value of 1 to the array nvar in slot NN.

Primarily, what I don't understand is what the latter part of the read statement means in parentheses. Any help explaining what the syntax means would be greatly appreciated.

-PK
 
Hi PKCHRIS

This is a built-in loop from 1 to NVAR(NN). The READ statements reads:

NVAR(NN), VAR(NN,1), VAR(NN,2), VAR(NN,3), ..., VAR(NN,NVAR(NN))

 
Thank you so much! This is exactly what I needed to know!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top