Fortran Tools: FSPLIT and FPR

This section describes the following Fortran command-line tools:


FSPLIT and FSPLIT90

The FSPLIT and FSPLIT90 tools split a multi-routine Fortran file into individual files. These tools are useful if you have a large Fortran program.

Use FSPLIT90 when your program uses free-form source or Fortran 95/90 constructs. Use FSPLIT for FORTRAN 77 code. The FSPLIT and FSPLIT90 commands have the same form:

FSPLIT [ options ] [input-file...]

FSPLIT90 [ options ] [input-file...]

options
Is one of the keywords listed in the following table. If more than one option is specified, separate each with a space. The command options are:

Option  Description
-e:name Processes only the program unit name. You can specify more than one -e name on a command line.
-extend_source Treats the statement field of each source line as ending in column 132, instead of column 72.
-help, ? Displays information about the FSPLIT command.
-nologo Suppresses the copyright notice that is displayed when FSPLIT or FSPLIT90 is run.
-silent Suppresses display of the name of each file opened (input and output files).
input-file A Fortran source file to be split. You can specify more than one file by using a list of files. If input-file is omitted the FSPLIT or FSPLIT90 Utility reads from standard input.

input-file
A Fortran source file to be split. You can specify more than one file by using a list of files. If input-file is omitted the FSPLIT or FSPLIT90 Utility reads from standard input.

FSPLIT or FSPLIT90 splits multi-routine Fortran files into separate routine files of the form filename.for, where filename is the name of the program unit (for example: a function, subroutine, block data, or program). The name for unnamed block data subprograms has the form blkdtannn.for, where nnn is a 3-digit code. For unnamed main programs, the name has the form mainnnn.for.

If there is an error in classifying a program unit, or if filename.for already exists, the program unit is put in a file named zzznnn.for, where nnn is a 3-digit code.

Normally each subprogram unit is split into a separate file.

Avoid using the -e option for unnamed main programs and block data subprograms since you must predict the created file name.

If FSPLIT or FSPLIT90 cannot find the names specified by the -e option, an error message is written to standard error device.

The following command example splits the subprogram units readit and doit into separate files:

   FSPLIT -e readit -e doit prog.for

FPR

The FPR tool transforms files formatted according to Fortran's carriage control conventions into files formatted according to line printer conventions. The FPR command has the following form:

FPR [-f record-size] [filename]

record-size
Specifies a fixed-length record as input. The record-size must be a decimal integer.

filename
Specifies the data file to be transformed.

FPR copies the input filename onto itself, replacing the carriage control characters with characters that will produce the intended effects when printed using the PRINT command. The first character of each line determines the vertical spacing as follows:

Character Vertical Space Before Printing
Blank One line
0 Two lines
1 To first line of next page
+ No advance
$ or ASCII NUL One line; no return after printing

FPR interprets the first character of every line of input, even if that character is not a recognizable control character. Control characters that are not recognized are treated as blanks and result in a single line advance.

FPR handles stream and fixed-length files. Input to FPR is assumed to be a stream (Stream_LF) file, unless you specify the -f option.

No diagnostic message is issued when FPR encounters an unrecognized control character.