Common Data Items
ANSI
Common Data Items are data or file definitions that are passed unchanged between programs. All data definitions are initialized as defined. Common data and file definitions are designated by an asterisk (*) preceding the field size or following the file type. The first program loaded initializes the defined Common Data Items.
Note the following:
Common Data Items must be of the same type and size and reside in the same position at the start of the User Data Area for each chained program. Common data size may be increased or decreased in subsequent programs but the Common Data Items must always remain in alignment.
Common Data Items must be contiguous and precede all other data or file definitions.
Failure to follow rules one and two may cause unpredictable results.
Common Data is not propagated to LOADMOD modules and does not require data alignment. Any calling routine variables needed in a LOADMOD module should be declared as GLOBAL or passed as arguments to the ROUTINE or PROCEDURE in the module.
Common Data Items may be any Data Definition (DIM, INIT, FORM, or INTEGER, including ARRAYS) or the File Definitions AFILE, FILE, or IFILE.
The Common Data Items are a part of the Program Data Area and are included in any size calculations for the Data Area.
Three Data Definition Labels are reserved as Common Data Items (and in the Global Data Area for PLBCMP) for every program:
S$ERROR$ is a twenty-two (22) byte DIM for SUNDB86x or a sixty (60) byte DIM for PLBCMP that contains any error codes resulting from a PL/B instruction. It is blank filled if no error has occurred.
S$RETVAL is a five (5) byte FORM that passes a return value to the operating system with a STOP, DSCNCT, or SHUTDOWN. A value may be placed in it as the program's return value for operating system-level batch processing. For Linux, the exit status of an EXECUTE statement is placed in S$RETVAL.
S$CMDLIN is a 128 byte DIM
for SUNDB86x or a 250 byte DIM
for PLBCMP from which any data following the program name entered
on the command line is placed. It is null unless data followed the program name entered on the command
line. For example
|
Runtime |
Command Line |
S$CMDLIN contents |
|
SUNDB86 |
PROGRAMNAME password |
password |
|
PLBCMP |
PLB PROGRAMNAME password |
password |
ANSWER password' was entered, S$CMDLIN
would contain ` password' upon entry into the program `ANSWER').
S$CMDLIN would also contain any information after the program name in
a CHAIN
instruction, such as:
CHAIN
"MYPROG THIS IS A TEST"
After the new program was loaded, S$CMDLIN would
contain 'THIS IS A TEST'.
S$CMPVER$' that has an equated value for the compiler version being used. This compiler equate conditionally compiles program logic based on the compiler version. This compiler equate is automatically generated for a program and can be referenced as needed.
Example: ( For 9.1D PLBCMP )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Assume these variables are passed between programs. The first program declares them:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
then all successive programs would declare them as follows:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Using this example, the variables would retain the values set by the previous program. They are not re-initialized and blank filled by this program.
See Also: Global Data Items, Data Definitions
![]() |