In the case of large programs, it is often advantageous to ensure that all individual program sections to be accessed concurrently by several users (or tasks) are made shareable.
The following compiler option must be specified at compilation in order to generate shareable programs:
//MODIFY-MODULE-PROP SHAREABLE-CODE=*YES
For each compilation unit, the compiler generates one LLM containing a non-shareable data CSECT and a shareable code CSECT. The code CSECT is marked with the attribute PUBLIC.
A subsequent linkage run creates a PUBLIC slice from the code CSECT and a PRIVATE slice from the data CSECT.
The PUBLIC slice is declared shareable by the system administrator with the ADD-SHARED command, and only the PRIVATE slice is subsequently loaded with the START-EXECUTABLE-PROGRAM command.
Example
/START-CPLUS-COMPILER //MOD-SOURCE-PROP LANG=*C //MOD-MODULE-PROP SHAREABLE-CODE=*YES //COMPILE SOURCE=MODUL1.C,MODULE-OUTPUT=*LIB-ELEM(LIB=A.TEST) //COMPILE SOURCE=MODUL2.C,MODULE-OUTPUT=*LIB-ELEM(LIB=A.TEST) //END /START-BINDER //START-LLM-CREATION INT-NAME=TEST,// SLICE-DEFINITION=BY-ATTRIBUTE(PUBLIC=*YES) //INCLUDE-MODULES LIB=A.TEST,ELEM=(MODUL1) //INCLUDE-MODULES LIB=A.TEST,ELEM=(MODUL2) //SAVE-LLM LIB=B.TEST,ELEM=TEST //END /ADD-FILE-LINK LINK-NAME=BLSLIB01,FILE-NAME=$.SYSLNK.CRTE /START-EXECUTABLE-PROGRAM FROM-FILE=*LIBRARY-ELEMENT(/ LIB=B.TEST,ELEM=TEST),/ DBL-PAR=*PAR(RESOLUTION=*PAR(ALTERNATE-LIBRARIES=*BLSLIB##))