ftn infile [infile]* [option]* [runtime-file]*
(+|-)BCd (-) (+|-)Clear (-) (+|-)FDeBug (-) (+|-)Formatted (+) (+|-)Go (+) (+|-)Include (+) (+|-)lineNumbers (-) (+|-)ListIng (-) (+|-)Load (+) (+|-)LoadBstar (-) (+|-)LstOu (-) (+|-)Map (-) (+|-)Optimize (-) (+|-)Tables (+) (+|-)Warning (+) (+|-)Xref (-) (+|-)Zdebug (-) nn<[filename] nn>[filename] Hstar=filename (.h) Library=filename LoaderMemory=number (10) MeMory=number (32) Name=name (object) Object=filename TEST=filename Time=number Update=filename
ftn * ftn srcpart1 srcpart2 01</myfile 02>02 10< ftn /subra up=tlib +clear
FTN is normally used to compile and run Fortran programs. You can also use it to restart a program without having to recompile. Since FTN uses the DRL TASK interface, compilation takes place in batch but loading and execution take place in TSS. To rerun your program without recompiling it, specify the name of the load module rather than the source files on the command line.
By default, the load module is written to a file named ".h". You can specify a different output file with the Hstar= option.
The sections that follow discuss how to specify run-time files, how to include command options in a source file, and how to handle loader considerations.
The default compilation options assume that your source program is in fixed format, i.e. it follows the usual Fortran rules: statement number columns 1-5, continuation marker column 6, statements columns 7-72, ignore column 73 and on, and comments are indicated by a "c" in column 1.
There are two other formats accepted by the Fortran compiler:
In both free format modes, beware of starting a "call", "character", or "common" statement in column 1, since the compiler sees a "c" in column 1 and treats the statement as a comment. This also applies to assignment statements whose variables begin with "c".
FTN lets you associate an I/O unit in your program with an actual file. You do this using a run-time file specifier of the form
nn<[filename] or nn>[filename]
Each specifier may be used for one of three purposes:
A specifier containing a "<" character is for reading only. A specifier containing a ">" character is for reading or writing.
When a program contains a statement like
read(1,100)a,b
Fortran I/O attempts to read from file "01" in the AFT. The file associated with the unit must be in the AFT with an aftname that is the same as the file code, expressed as two digits. If it is not there, the I/O package calls ACCESS so you can access it. FTN lets you do this ahead of time.
Suppose you wanted unit 01 to read from your file "data1". You would do this by including
01</data1
on the command line. In response to this, FTN accesses the file "/data1" under the alternate name of "01". As long as you do not remove "01" from the AFT during the session, you do not have to specify this again, because FTN does not remove run-time files from the AFT. Thus, a basic run-time file specifier consists of a two digit unit number (in the range 01 to 44), a "<" or ">" character, and a file name.
As already noted you must use ">" rather than "<" if your program needs to write on the file at any time. In this case, if the file does not already exist it is be created as either temporary or permanent, according to the usual conventions for implicit file creation.
For example, suppose you wish the output generated by unit 02 of your program to be directed to a temporary file called "02". You would specify
02>02
on the command line. Again, as long as you do not deaccess the file, you need only specify this once during the session.
In Fortran I/O, units 05, 06, 41, and 42 are associated with the terminal by default, while all other units are associated with a disk file. Unit 41 is used by a READ statement which has no unit number. Unit 42 is used by the PRINT statement.
To make a terminal-oriented unit read from a file, you must use a specifier in your FTN command. For instance, to send output on unit 06 to a file, you would say
06>/out1
which would first create "/out1" if necessary, then access "out1" under the alternate name of "06", then modify the load module so that Fortran run-time initialization is aware of the deviation from the default. IMPORTANT NOTE: If you redirect 06 into a permanent file, you will not be able to look at the file until you issue the TSS command
remo 06
The reason is that the file is incorrectly positioned for reading as long as it stays in the AFT, so you have to remove it from the AFT before you can read it.
For Fortran I/O to read from the terminal instead of a disk file, you just omit the file name altogether, as in
10<
This specifies that unit 10 is associated with the terminal instead of a disk file. When associating a unit with the terminal, you may use either ">" or "<".
There is one nasty glitch in all this. If the file name you specify is that of a temporary file, the name must be the same as the unit with which the file is to be associated. If it is not, FTN tells you that you must use the RENAME command yourself to change the name of the file. This is necessary because you cannot have an alternate name for a temporary file.
The listing produced by the +ListIng option is left in your AFT with the name "fc*p*". This listing is in Media3 format, fixed length BCD. If you wish to list this on the printer, simply use SLIST, as in
slist fc*p*
If you read "fc*p*" into FRED, you find that each line ends with the cryptic notation "!10000". This arises because FRED is not fully at home with Media3 files. To eliminate this odd glitch, you might use the L command to list "fc*p*" into another file (thereby performing BCD to ASCII conversion) and then read this converted file into FRED, as in
l fc*p* >temp fred r temp
A source file may specify additional FTN command options on a line that begins with "*!". The "*" causes the line to be taken as a comment by the compiler, while the "!" causes the line to be scanned by FTN. Such a line may of course have a line number, but the "!" must always be followed by at least one blank. There may be more than one such special comment line, but all the lines must appear at the very beginning of the file, as in
*! +form +optz *! -linenum print,"hi there" stop end
If FTN discovers a source file line of this form, FTN displays the line on the terminal. You can tell FTN not to scan for such lines by using the -Include option on the FTN command line.
Options found in source files are processed in the order they are displayed on the terminal. Options on the command line (other than source or object file names) are processed last, so that you may use the command line to override options from the source files. For instance, if a numeric or string-valued option like Object=filename is given more than once, FTN uses the last argument processed.
Normally when you compile a program, FTN assumes that you want the program loaded and executed. However, if you ask for an object deck or a Ranedit into a random library, FTN only calls the loader if you also specify an option like Hstar= that applies directly to the loader. We recommend that you do not specify loader options with the Update= option; in future releases, this may be regarded as an error.
There may be times when a compilation works fine but you find you must recompile, perhaps because you omitted a library name in the option list or because you omitted some loader option. You can avoid recompiling the program again by using the +LoadBstar option instead of the source file specification in your FTN command. This reperforms the load step using the object decks generated by the most recent compilation.
b*, j*, c*, l*, *l
fc*r*, fc*sc, fc*i*, fc*p*, fc*s*, fc**1
cmdlib/etc/qstar cmdlib/etc/nullgeload
.h
Copyright © 1996, Thinkage Ltd.