Topic: Getting started manual? Deja Vu all over again

About six months or so ago I started in on Simply FORTRAN, but other responsibilities curtailed that effort and now I am starting again. I'm looking for a source - website, pdf file, etc. that gives the current sytax requirement and "best practices" for this Simply Fortran version.

I am not looking for a "How to program" book, I'm looking for something to show the required syntax.  For example, a simple loop that reads till EOF. Over the years, and with at least 5 major languages, I have written similar code - that's the problem. Too many syntaxes under the bridge.

I bought some used Fortran 90/95 for Engineers book but it doesn't seem to match as well as I'd like. Their Read examples act on end of file by testing for an I/O error and If true, EXIT.

My questions are more - what does a read statement look like, (do you have to set some kind of "Open"); That would be any pre-conditions (statements), the Read itself, tied to a Format statement, with a test for EOF.

Something similar would be nice for Write. That would be writing to a file or the screen (Print *), or print to a laser printer.

The book mentioned above shows "not equal" as "/=". Last time I needed not equal it was "<>".

I've used IF's that are just IF [condition] Action and others that require IF [condition] THEN Action.

If there is that kind of syntax (with simple examples) documentation in the support section, please point the way. I've looked at the documentation for GNU compiler but ether it doesn't show what I'm looking for or I missed it among the list of links.

So again, I'm not asking, "How do I program" in the sense of breaking a problem down into small enough steps that can be handled by the compiler's features/ability." I'm asking were to find the grammar requirements for file I/O, looping, conditional statements, and marking comments, in this environment.

Thank you.

Re: Getting started manual? Deja Vu all over again

An example of my problem is I spend a long time trying to get a simple program to compile. It wasn't seeing and End Do. But it wasn't seeing an End Do because it didn't like my IF statement. I my most recent environments "=" was equal and I could compared things like IF (A = B) than ... But in this Fortran I had to use IF (A == B) than ...
So I'm asking, where do I look to learn the syntax for this environment; that I have to use "==" for equal in a conditional instead of "=".

Re: Getting started manual? Deja Vu all over again

Simply Fortran's compiler is basically a highly standards-compliant Fortran compiler that implements very few extensions. Any standard Fortran text book should provide an overview of the syntax necessary.

Of course the above statement is complicated by the fact that Fortran 77 and Fortran 90 (and higher) are quite different at first glance.  However, if you stick with Fortran 90 syntax, which can be used in fixed-format Fortran (which looks a lot like Fortran 77), you'll probably be okay.

I can address some of your specific questions, though.  In regards to reading a file, yes, the Fortran standards-compliant method is to detect an error on read using the iostat argument.  This methodology is similar to many languages. 

Writing to files is performed using the write statement and specifying a unit number.  Files would be opened using the open statement, which can be complicated.  Your book you mentioned should cover the important facts.  However, directly writing to a printer just isn't possible these days.  When line printers were common, writing directly to a printer made sense.  However, writing to a laser printer requires fonts to be specified, buffering data until a full page is ready, device drivers for drastically different printer technologies, and complicated, operating-system-specific interfaces to printing utilities.  Using printers directly just isn't an option since the demise of tractor-fed dot matrix printers.

Equality is tested using double equals or Fortran's .EQ. operator.  A single equals sign can only be used for assignment.  The "not equal" operator is derived, presumably from the C syntax of "!="; however, Fortran already uses exclamation points for comments, so the new operator was decided as "/=" in the modern syntax.  Again, you can use Fortran's older operator, .NE., instead of the "/=" method.  The only place I've seen the "<>" operator is BASIC, but some other Fortran compilers may have implemented that operator as a custom extension.

IF statements should generally have a corresponding THEN if you plan on having subsequent instructions on a new line.  The modern syntax is to use a THEN and place statements on a new line, closing out the code block with END IF on its own line.

We don't have a syntax guide for our compiler, though, since it is a standards-compliant compiler.  If you want a more thorough breakdown of the modern Fortran syntax, I would suggest:

Modern Fortran Explained by Metcalf, et al.

Modern Fortran by Curcic

We have had other requests for a syntax guide, but such an undertaking is enormous.  It would be a substantial task to complete a guide for our compiler.

Jeff Armstrong
Approximatrix, LLC

Re: Getting started manual? Deja Vu all over again

Yeah, it's been a while since the only book worth reading was McCracken, chain drive printers, and sophisticated format statements to control the printout smile

Thank you for your reply, recommendations, and patience. The waters were muddied because the Engineering book showed real/integer typing done by putting :: between the type and variable list, let leaving the :: out still worked. Like Integer :: Myinteger vs Integer Myinteger both worked.

It seemed like French were they toss in a consonant and then don't even pronounce it. If :: is unnecessary why have it.

Then there's the exiting from reading to the end of file with what looks like an error check. There's a difference between a read error and normally reaching the EOF (end of file).

Oh well, this dog has some new (syntax) tricks to learn. It's funny - I have a few options (Xojo, PanoramaX database [strong programming language], Visual Studio) but one's first love is always ready (unless she's moved on - but that's a different issue).

I'll go through Chapman's book, think of X-Files, and BELIEVE when I see their examples.

5 (edited by JohnWasilewski 2021-03-09 00:25:24)

Re: Getting started manual? Deja Vu all over again

When I have long gaps between Fortran coding episodes, I easily forget the exact syntax.  To overcome this, I have made some entries in the Tools menu, which enable me to pull down and scroll through any number of manuals and handbooks as PDF files from inside Simply Fortran (eg a DISLIN manual or a Fortran syntax handbook), just by selecting its name from the Tools drop-down.