The naming and structure of COMMONs

Most Xtal programs use labelled commons to store variables that are used in more than one subroutine. Variables used in the nucleus routines, as well as in program subroutines, are stored in a system common. This will be described separately below.

The layout of the COMMON definitions is illustrated in the above example for XANAX. The type definition statements (e.g. INTEGER, REAL, string:, etc.) and the labelled common statements are declared at the start of a program, and must be surrounded by extrude: and endext: instructions. These instruct the RFPP preprocessor to create a file named **COMN containing the common information. In the above example this file is 'inserted' into the Fortran code via the include:(**COMN) instruction which must be at the start of any subroutine employing common variables. Note that in the example above the file named XXCOMN would be generated.

The abbreviated program code is also used to identify labelled commons. For the program XANAX, the labelled common containing floating-point variables is COMFXX; that containing integer variables is COMIXX; and that containing character variables is COMCXX. If a common declaration exceeds one line, the continuation digraph $# is appended to each line except the last. Occasionally the total length of the labelled common declaration can exceed the buffer space of the preprocessor and it will be necessary to use several labelled commons. This is the case for the program SFLSX where integer variables are declared in the two commons labelled COMIS1 and COMIS2.

The number and size of common variables is kept as small as possible. Commons should not be used for major data storage applications. This must be done in the QX array, which is part of the system labelled common QXDATA (described below). Only variables used to transfer data from one subroutine to the next should appear in the common. It should be noted that on many machines there can be a time penalty associated with the use of common variables as opposed to locally declared variables.