SHARED_CODE

For many UNIX machines, ACUCOBOL-GT supports the ability to have multiple users share the same copy of a COBOL program's object code in memory. This configuration variable indicates which programs you want to share code. Use of shared memory is recommended only if you have a problem with limited memory and excessive swapping. In this case, the advantage of reduced swapping will usually more than make up for the overhead added by sharing memory. To use shared code for all of your programs on UNIX, add the following line:

SHARED_CODE   1

This will cause all programs to attempt to share code. Every code segment loaded into memory will be placed into shared memory until shared memory is full. Further code segments will then be placed in conventional memory. If the system runs out of shared memory and the shared code requests start failing, each runtime will have its own copy of the program in its own memory space.

Since shared memory is a limited resource under UNIX, you will usually want to restrict the use of shared code to those programs where it will be most beneficial. This will ensure that other programs do not use up all of the available shared memory first. To do this, specify each program you want to share as follows:

SHARED_CODE  Program1
SHARED_CODE  Program2
SHARED_CODE  Program3

(The program name may also be enclosed in single or double quotes, for example, "Program1" or 'Program2'.) When you use this method, Program1, Program2, and so forth are the PROGRAM-IDs from the programs' Identification Divisions (note that a program's object file name is not used). If you use this method, then setting SHARED_CODE to 1 will have no effect.

See acushare Utility Program in the ACUCOBOL-GT User's Guide for more information.

Note: This variable cannot be read with the ACCEPT FROM ENVIRONMENT statement.