×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

format

format

(OP)
This might sound simple to some of you, but what is the difference between a fixed format file and a free format file? Can they be mixed together in projects? If a subroutine is written in one format can it then be re-written in the other without making changes?

John

RE: format

If you are speaking of data files processed by a program as it runs, then reading values from a record of a file is either under format control (a FORMAT statement or format string contained as a literal within the READ statement), or the READ statement specifies no format (just "*") and the data values on the record are separated by blanks or commas (and multiple records could be absorbed to satisfy the whole READ list. This is a bit simplified; consult a good Fortran manual.

Now if you are speaking of the format of Fortran source files, as your last sentence suggests, you can have one file be in fixed format (statement numbers in columns 1-5, continuation character in column 6, statement body in columns 7-72), and another file be in free format (no column designations, lines to 132 characters, different designation of continuation lines), and compile each file separately, telling the compiler which form to expect for each. Your compiler may have a command line or default switch telling it which form is given, or it may take the form from the file extension; the Lahey LF95 compiler offers both ways. But you can't combine files so that one part of the file has a subroutine in fixed format and another has a subroutine in free format. Refer to your Fortran language manual for rules on the different forms.

RE: format

I thought you could include the $FREEFORMAT and $NOFREEFORMAT metacommands in the same file and thereby you could mix free format with formatted.  I don't have the manual handy, so maybe I'm wrong. BTW, I'm talking about Compaq or HP or whatever they call it now Fortran.  As a matter of fact I'm pretty sure I'm remembering a program of mine that has mixed (free format and not) source code.  Seems like I'm always answering these things at home but my reference material is at work, sorry.

RE: format

Meta commands ($something) are compiler-specific. If jgbeckett's compiler supports having mixed form source, with the form of various blocks of code within a file identified with such commands, then he's in luck. The user's guide to his compiler would tell him if this is supported. Mixing forms isn't a good idea, as it introduces compiler-dependency. Convenience now, in the form of less work to piece together chunks of different source codes, likely will make for more work by someone later on.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members! Already a Member? Login


Resources


Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close