Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Fortran 77 command write

  1. Mar 26, 2013 #1

    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

    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
  2. jcsd
  3. Mar 26, 2013 #2


    Staff: Mentor

    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.
  4. Mar 26, 2013 #3

    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
  5. Mar 26, 2013 #4


    Staff: Mentor

    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.
  6. Mar 28, 2013 #5
    Thanks for the answer, Mark.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook