Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is this "suffix" syntax on the end of every line of a Fortran code called?

Tags:

fortran

I recently inherited a legacy Windows binary and its source code, which is apparently written in Fortran(the language I am not familiar with). Trying to understand how it's working, I peeked into the source code and this syntax just caught my eyes:

    DIMENSION X(10)                                                   ABC02340
    C                                                                 ABC02350
     X(1)=9.876543D-2                                                 ABC02360
     X(2)=1.234567D-1                                                 ABC02370
     X(3)=2.587539D-0                                                 ABC02380
     X(4)=6.549873D-0                                                 ABC02390
     ...

(The example code above is tweaked a bit for the sake of confidentiality)

Most of the lines of the source code had 8-letter "suffixes" that consists of:

  • Three-letter upper case alphabet, same for all the lines
  • 5-digit number, increasing for every line by 10 (in most cases) or more

They are (mostly) perfectly aligned vertically, occupying 73rd-80th characters of most of the lines. Some of them are commented out along with code. I even found some that are adjacent to closing brackets without a single space.

What is strange is that, I have yet to find a code example of Fortran with this "suffix". I tried searching some keywords such as "suffix", "label", "row number" or "end of line" but no avail. So far I figured out that they are neither comments, nor labels for GOTO statements.

Question: What are those "suffixes"? What is the name of this syntax? Or is this just a habit of original developer with some pre-compile macro involved?

like image 562
user6493398 Avatar asked Nov 24 '25 10:11

user6493398


1 Answers

This is a sequence number and is rarely used today for obvious reasons:

It was not uncommon for the programmer or the operator of the card reader to drop some or all of the cards on the floor, which usually put them out of order. The only insurance against this disaster was to punch a sequence number in columns 73-80 of each card, so that if they got scrambled they could ... be put back in order using a mechanical card sorter.
Classical Fortran

When using fixed format, only the first 72 columns of each line are scanned.

like image 77
Salem Avatar answered Nov 27 '25 08:11

Salem



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!