ContentsIndexPreviousNext

2.11.1.1 Indicating programs to share

Use your COBOL configuration file to indicate which programs you want to share code. By default, no programs will share code. To use shared code for all of your programs, 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. The UNIX default for SHARED-CODE is "0" (no programs share code).

Since shared memory is a limited resource under UNIX, you will probably 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 in your runtime configuration file each program you want to share as follows:

SHARED-CODE   Program1
SHARED-CODE   Program2
SHARED-CODE   Program3

When you are using this method, "Program1", "Program2", and so forth, specify the PROGRAM-IDs from the programs' Identification Divisions (note that a program's object file name is not used). If you use this method, setting SHARED-CODE to "1" will have no effect.

To maximize the benefits of code sharing, begin by restricting the use of shared code to those programs that have many users and are large. Then, if you find that you have enough shared memory in your system, you can extend its use to small programs that have many users. Use the reporting facility in acushare to help you optimize the use of shared memory.