.TEMPLATE files, except they define
initial values rather than defining data structures.
Constants files always have the file extension .CONSTANT.
Sometimes they have the same file name as the corresponding
.TEMPLATE, but this not required.
As a first example, look at the constants file that the Event Display uses
to define what kinds of objects you can DSP ADD.
PRODDISPLAY:DSPTYPS.TEMPLATE
PRODDISPLAY:DSPTYPS.CONSTANT
Get both of these files into your editor so you can compare them.
In the template file, notice that each DSPTYPS bank has a
GNAME, a GDESC and some other elements
including a repeat block called TYPE.
Don't worry too much about the details. Just understand the overall structure.
There may be any number (up to a MAXID of 32) different
DSPTYPS banks. Each DSPTYPS bank can contain
some variable number of TYPE blocks.
Now look at the constants file: PRODDISPLAY:DSPTYPS.CONSTANTS.
You should see constans for 3 DSPTYPS banks.
DSPTYPS bank contains information for 6
TYPE blocks.
DSPTYPS bank contains information for 14
TYPE blocks.
DSPTYPS bank contains information for 3
TYPE blocks.
If you just study the .CONSTANTS file and the corresponding
.TEMPLATE file, the system should become clear to you.
BLOCK statement and an ENDBLOCK statement.
BanK statement and an ENDBANK statement.
JZBADD.
For example, your Prepmort file could contain the line:
$CALL JZBADD( 'DSPTYPS', P_DSPTYPS ) ERROR RETURN;
This would create a DSPTYPS bank based on the
DSPTYPS.TEMPLATE.
But this would not read the constants file.
The only initial values you would get would be those that were set in
the template file.
To create banks with initial values based on a constants file,
you instead use the routine JZKGET.
For example, your Prepmort file could contain the line:
$CALL JZKGET( 'DSPTYPS', 'RELOAD' ) ERROR RETURN;
This would create a set of DSPTYPS banks based on the data in
DSPTYPS.CONSTANT.
The option 'RELOAD' insures that if there already was such a bank,
it will be replaced.
If you specify ' ' instead of 'RELOAD',
any bank that already existed will be left untouched.
This is almost all you will need to learn about the constants system unless you get into very advanced software. In that case, consult section 12 of the Jazelle manual. One note on that manual, it says that run-dependent constants are not yet implemented. They are indeed now implemented.
It is the name inside the constants file, in the BANK statements,
that needs to match the template file name.
The thing that cares about the constants file name is the JZKGET
routine.
For example, things would work out fine if we:
DSPTYPS.CONSTANT to be NEWNAME.CONSTANT
$CALL JZKGET( 'DSPTYPS'...) to
$CALL JZKGET( 'NEWNAME'...)
In fact, a single constants file can contain constants information to fill
many different templates.
As an example, look at the file PRODDISPLAY:DSTUDSP.CONSTANT.
This file defines everything the Event Display system needs to know to
about displaying Mini-DST information.
The file contains the following kinds of banks:
DSPUSRT
DSPUPRI
DSPUSRR
DSPUMNU
DSPUVLU
DSPUVPR
DSPUINI
DSPUREF
DSP USERDATA DSTUDSP
the first thing the event display does is run the statement
$CALL JZKGET( 'DSTUDSP', 'RELOAD' ) ERROR RETURN;