Fortran statement number error

Asked 1 years ago, Updated 1 years ago, 99 views

Thank you for your help.
I am writing the Fortran code using gfortran, but I get an error in the following parts.

 200 format('size:',2I3,'hot(0)/cold(1):',I2,
  &'Therm:', I5, 'Int:', I5, 'NCONF:', I5, 'h:', F6.2)

Here's the output:

 253 | 200 format ('size:', 2I3, 'hot(0)/cold(1):', I2,
      |       1
Error: Invalid character in name at (1)
test.f:254:7:

  254 | & 'Therm:', I5, 'Int:', I5, 'NCONF:', I5, 'h:', F6.2)
      |       1
Error: Invalid character in name at (1)
test.f:251:72:

  251 | & , getExternalMagnetFiled()
      |                                                                        1
Error: FORMAT label 200 at (1) not defined

I looked it up online, but I can't find a solution.
Please let me know if you know the solution.
Thank you for your cooperation.

fortran

2022-09-29 21:26

1 Answers

It is probably an error due to the fixed format of Fortran77.
I don't know how many columns the boundary condition started, but try to put & in the sixth column with the first 200 to the left of the seventh column.
I tried it under this environment and it worked.

Tried code:

! Test Code
      program test

      write(*,200) 316, 23, 15, 12345, 12345, 12345, 311.25
200 format('size:',2I3,'hot(0)/cold(1):',I2,
     &'Therm:', I5, 'Int:', I5, 'NCONF:', I5, 'h:', F6.2)
       end program


2022-09-29 21:26

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.