What is the purpose of the Fortran 77 DECK statement?

  • Fortran
  • Thread starter jf22901
  • Start date
  • Tags
    Fortran
In summary, some Fortran code uses the DECK directive, which might be a source-code management system used in the UK in the 1990s.
  • #1
jf22901
55
1
Hi all.

I am using some Fortran 77 code that was originally written in the early 90s, and some of the subroutines start with DECK or *DECK. I have tried searching the internet but cannot find anything relevant. As an example, say the main program calls two subroutines SUBONE and SUBTWO. One of these subroutines is of the form

Code:
DECK SUBONE1
      SUBROUTINE SUBONE(arguments)
      <code for rest of subroutine follows>
and the other is of the form
Code:
*DECK SUBTWO1
      SUBROUTINE SUBTWO(arguments)
      <code for rest of subroutine follows>

Can anyone enlighten me to what the DECK statement is for, and why some subroutines have an asterisk in front of it? I'm guessing that the 'SUBONE1, SUBTWO1' is the name of the relevant 'DECK', but that's as much as I can work out!

Thanks in advance. :smile:
 
Technology news on Phys.org
  • #2
As far as I know, there is no DECK statement in Fortran. I couldn't find any reference to it in a web search. In your second example, the line with *DECK in it is a comment. If DECK appears without a preceding * or C, as you show, I have no idea what it means.
 
  • #3
Thanks Mark.

Good to know it wasn't just my useless web searching skills! :smile:

The code all compiles ok, so it's not as if they are causing a problem - I was just wondering what they were there for. After a further look, the DECK statements only appear in subroutines that call additional subroutines. The code is from an old weather forecasting model, so it might be something specific they have added themselves, and not a standard Fortran thing.

Thanks again.
 
  • #5
jtbell said:
DECK appears to be a directive for a source-code management system called NUPDATE that was (maybe still is) used in the UK, e.g. at the Department of Meteorology (aha!) at Reading:

http://www.met.reading.ac.uk/~mike/dyn_models/nupdate/nupdate_doc.txt

Thanks jtbell, that's brilliant! It's an old UK Met. Office model I'm using (to model Mars' atmosphere), and I guess it was developed partly at Reading.

How did you stumble on that website? I tried loads of search combinations and still found nothing!
 
  • #6
It comes out at the top of a search for "fortran deck directive". I figured "directive" might be an appropriate generic term for it, since it's not an actual FORTRAN statement.

You can probably simply delete those DECK directives, unless you're using a system that actually uses them.
 
  • #7
jtbell said:
You can probably simply delete those DECK directives, unless you're using a system that actually uses them.

Or, put the code that follows
*DECK foo
in file foo.f, if you want to preserve the original file structure for some reason.

This stuff probably dates from when a "file system" was a big metal rack full of trays of punched cards, with about 2000 cards per tray, not something on a thumb drive.
 

Related to What is the purpose of the Fortran 77 DECK statement?

What is the purpose of the FORTRAN 77 DECK statement?

The FORTRAN 77 DECK statement is used to indicate the beginning of a new FORTRAN program unit, such as a subprogram or a main program. It also specifies the unit number for the input/output operations within the program unit.

What is the syntax for the FORTRAN 77 DECK statement?

The syntax for the FORTRAN 77 DECK statement is as follows:

DECK [unit number] [FORMAT] [NML=namelist] [I/O=variable list]

The unit number is optional and specifies the unit to be used for input/output operations. FORMAT is also optional and specifies the format of the input/output operations. Namelist (NML) and variable list (I/O) are also optional and specify the list of variables to be used for input/output operations.

Can multiple DECK statements be used in a single program unit?

Yes, multiple DECK statements can be used in a single program unit. This allows for more flexibility in choosing different input/output units and formats for different parts of the program.

What is the difference between the DECK and END statements?

The DECK statement marks the beginning of a program unit, while the END statement marks the end of a program unit. The space between these two statements is where the code for the program unit is written.

How is the DECK statement used for input and output operations?

The DECK statement is used to specify the unit number and format for input/output operations within a program unit. This allows the program to read in data from an external source or write data to an external file.

Similar threads

  • Programming and Computer Science
Replies
8
Views
3K
  • Programming and Computer Science
Replies
2
Views
2K
  • Programming and Computer Science
Replies
11
Views
14K
  • Programming and Computer Science
Replies
18
Views
6K
  • Programming and Computer Science
Replies
4
Views
4K
  • Programming and Computer Science
Replies
5
Views
3K
  • Programming and Computer Science
Replies
4
Views
10K
  • Programming and Computer Science
Replies
25
Views
8K
  • Programming and Computer Science
Replies
3
Views
1K
  • Programming and Computer Science
2
Replies
54
Views
4K
Back
Top