BATCH - how to use Fortran in batch.

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

By default, batch Fortran reads from unit 5, prints on unit 6, and punches on unit 7. No special set-up is required to handle these units. The minimal JCL For running a Fortran program in batch is

$	IDENT	userid,banner
$	OPTION	FORTRAN
$	FORTRAN
$$select(myuid/srcprog)
$	EXECUTE
$$select(myuid/data)     (data for unit 05)
$	ENDJOB

Note that if the $OPTION card is not supplied, the job dies in the execute step with a "derail fault" in the loader. You can compile a program and several subroutines in one $FORTRAN step or have several $FORTRAN 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 segregated into relatively small files.

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

$  FORTRAN  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 debugging tables (default)
NFDS
do not build debugging tables
NLSTIN
suppress program listing
LSTOU
list generated machine code
XREF
generate a cross reference

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 FORTRAN 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 $FORTRAN card, as in

$  FORTRAN  BCD

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

To force your program to write ASCII files in a batch and BCD environment, you must issue the call

CALL FMEDIA( FC, 6 )

for each file referenced. FC in the call is the Fortran unit number.

Copyright © 1996, Thinkage Ltd.