Fortran 77 command write

  • Fortran
  • Thread starter Triscas
  • Start date
  • #1
9
0
Hello,

I'm new using fortran and I don't know what does it mean:

write (4,*) ' '
write (4,310)
write (4,311)

this lines go consecutive in the programm I have to understand.

- might say that 4 is not a reference to a line of the code.
- 310,311 are references about how the format should be

i.e:
310 format('Distance C Elec C Sol Surf Liq Pot Solid Pot ',
&'Liq Cur j main j side 1 j side 2 j side 3')
311 format('(microns) (mol/m3) x or y (V) (V) ',
1' (A/m2) (A/m2) (A/m2) (A/m2) (A/m2)')



I hope someone can help. Thanks
 

Answers and Replies

  • #2
33,937
5,584
Hello,

I'm new using fortran and I don't know what does it mean:

write (4,*) ' '
write (4,310)
write (4,311)

this lines go consecutive in the programm I have to understand.

- might say that 4 is not a reference to a line of the code.
- 310,311 are references about how the format should be

i.e:
310 format('Distance C Elec C Sol Surf Liq Pot Solid Pot ',
&'Liq Cur j main j side 1 j side 2 j side 3')
311 format('(microns) (mol/m3) x or y (V) (V) ',
1' (A/m2) (A/m2) (A/m2) (A/m2) (A/m2)')
All of your write statements send output to unit 4, the first number in the parentheses.
write (4,*) ' ' -- prints a single space (' ') on unit 4, using a default format.
write (4,310) -- prints the string in the format statement in line 310, on unit 4. This string appears to be a header of some sort.
write (4,311) -- prints the string in the format statement in line 311, on unit 4. This string also appears to be some sort of header.
 
  • #3
9
0
All of your write statements send output to unit 4, the first number in the parentheses.
write (4,*) ' ' -- prints a single space (' ') on unit 4, using a default format.
write (4,310) -- prints the string in the format statement in line 310, on unit 4. This string appears to be a header of some sort.
write (4,311) -- prints the string in the format statement in line 311, on unit 4. This string also appears to be some sort of header.

what does unit 4 mean? The values will have a lenght of 4 characters?

yes, i also understood they're a header the other outputs. The second might be the units of the first
 
  • #4
33,937
5,584
what does unit 4 mean?
The unit number indicates which device you want to write to. In this case it would probably be a disk file that was assigned a unit number with an OPEN statement.
The values will have a lenght of 4 characters?

yes, i also understood they're a header the other outputs. The second might be the units of the first
 
  • #5
9
0
The unit number indicates which device you want to write to. In this case it would probably be a disk file that was assigned a unit number with an OPEN statement.
Thanks for the answer, Mark.
 

Related Threads on Fortran 77 command write

Replies
7
Views
4K
Replies
3
Views
2K
Replies
3
Views
1K
  • Last Post
Replies
1
Views
2K
  • Last Post
Replies
7
Views
5K
Replies
8
Views
2K
  • Last Post
Replies
1
Views
4K
  • Last Post
Replies
2
Views
2K
  • Last Post
Replies
1
Views
3K
Replies
29
Views
4K
Top