The COMMON statement declares a list of variables and matrices that can be shared among various programs. There can be many common areas including a default, unnamed common area.



COMMON {/CommonName/} variable{, variable ... }



The list of variables should not have been declared or referenced previously in the program file. The compiler will detect any bad declarations and display suitable warning or error messages. If the common area declared with the statement is to be named then the first entry in the list should be a string, delimited by the / character.



The compiler will not, by default, check that variables declared in COMMON statements are initialized before they have been used as this may be beyond the scope of this single source code check. The -JCi option, when specified to the jBC compiler, will force this check to be applied to common variables as well. The initialization of named common is controlled in the Config_EMULATE file.

Variables declared without naming the common area may only be shared between the program and its subroutines (unless CHAIN is used). Variables declared in a named common area may be shared across program boundaries. When any common area is shared, all programs using it should have declared the same number of variables within it.

Dimensioned arrays are declared and dimensioned within the COMMON statement.

Variables created with OPENINDEX, OPENSEQ and OPENSER cannot be included in COMMON.

Caveat (Unix/Linux only): Issuing su to another account will not reinitialize named common. When moving from one account to another, it is advisable to use LOGTO when named common is expected to be reinitialized.

Common variables are managed differently on different versions of jBASE. On jBASE 3, common and named common are stored, by port number, in the $JBCRELEASEDIR/tmp/jBASEWORK file. The means that the jBASEWORK file needs to be sized appropriately for logons, LOGTO and jRFS connections. On jBASE 4 (and above), common and named common are managed in shared memory.



COMMON A, B(2, 6, 10), c

COMMON/Common1/ A, D, Array(10, 10)