BATCH - how to use Fortran77 in batch.

In order to understand this explain file, you must know how to run jobs in batch.

By default, batch Fortran77 reads from unit 41, prints on unit 42, and punches on unit 43. Also units 5, 6 and 7 are set up for reading, printing and punching. No special set-up is required to handle these units. The minimal JCL for running a Fortran77 program in batch is

$     IDENT     *,banner
$     OPTION    FORT77
$     FORT77
$$select(myuid/srcprog)
$     NOLIB     *L
$     EXECUTE
$$select(myuid/data)     (data for unit 05 or 41)
$     ENDJOB

Note that if the $OPTION card is not supplied, the job will probably die with some strange message in the execute step. The most likely message is "abnormal termination code l1", because some library routine did not get loaded. Omitting the $NOLIB card may cause other strange results.

You can compile a program and several subroutines in one $FORT77 step or have several $FORT77 cards with different options for different segments of the source. The $$SELECT cards can be replaced by the card images themselves if you want, but you'll likely find it convenient to keep JCL in separate files and to keep your programs split into relatively small files.

You can submit "free-format" Fortran to the batch compiler by judicious use of options in the $FORT77 card. For free format data with line numbers, you would say

$     FORT77     LNO,NFORM

The defaults are NLNO and FORM. If you are not using the defaults, it is usually a good idea to specify one of LNO/NLNO and one of FORM/NFORM explicitly.

Here is a summary of the compiler options that you might find useful.

FORM
input is in ANSI standard format
NFORM
input is free format (* comment, & continuation)
LNO
input has line numbers
NLNO
input does not have line numbers
ASCII
ASCII set, four characters per word (default)
BCD
use the BCD set, six characters per word
FDS
build FDS type debugging tables
NLSTIN
suppress program listing
LSTOU
list generated machine code
PARCHK
generate code to check for parameter mismatches
SNUMBER
generate line number tables for meaningful tracebacks
SUBCHK
generate code to check array bounds
XREF
generate a cross-reference table
DML
invokes the DM-IV transaction processor
NWARN
only prints out diagnostics for fatal compilation errors

It is perfectly acceptable to use a $PRMFL card as a source of input to the compiler. The compiler happily transliterates all non-ASCII input into ASCII, its "native" character set. Source input via a $PRMFL card to the FORT77 compiler must have a file code of "S*", e.g.

$  PRMFL  S*,R,S,yourid/filename

FORTRAN programs may be compiled to handle either ASCII characters or BCD characters.

To force your program to run in BCD mode in batch, you must use the BCD option of the $FORT77 card, as in

$     FORT77     BCD

As a rule, it is never advisable to mix routines compiled in BCD mode with routines compiled in ASCII mode.

Search Rules:

If you use INCLUDE statements with search rules, you can specify the search rules with:

$     DATA     SR
rule
rule
 ...

See Also:

expl f77 include
for a more detailed discussion of search rules and include statements.

Copyright © 1996, Thinkage Ltd.