Built-in variable
Built-in variables that define a segment can optionally be qualified by using a segment name, as in the following:
An example expression that includes a segment name definition, followed by a built-in variable follows:
If no segment qualification is specified, a default segment is implied. The default segment is identified elsewhere, normally using the SEGMENT keyword. So if SEGA was not specified, then SEGB would be used as shown in the above example.
Built-in variables that are available for use within expressions are shown in the following table:
Built-in variable name | Data- type | Description | Usage availability/limitations |
---|---|---|---|
Common Variables | |||
AREA_NAME | 8C | Area DDname | Available for all expression types |
AREA_NUMBER | 1X | Area number | Available for all expression types |
DBD_AREAS | 2F | Number of areas defined in DBD | Available for all expression types |
DBD_LEVELS | 2F | Number of segment levels defined in DBD | Available for all expression types |
DBD_NAME | 8C | DBD member name | Available for all expression types |
DBD_SEGMENTS | 2F | Number of segments defined in DBD | Available for all expression types |
RUNDATE1 | 4X | Date that the program began execution | Available for all expression types |
RUNDATETIME1 | 12X | Date and time the program began execution | Available for all expression types |
RUNTIME1 | 4X | Time the program began execution | Available for all expression types |
TODAY1 | 4X | Alias of RUNDATE | Available for all expression types |
Segment Definition Variable | |||
SEGMENT_CKEY | n1C2 | Concatenated key for current segment | Not available for expressions that define:
|
SEGMENT_CODE | 1X | Segment code | |
SEGMENT_LEVEL | 1X | Segment hierarchical level | |
SEGMENT_NAME | 8C | Segment name | |
SEGMENT_LENGTH | 2F | Length of segment | |
1 The DATE_TIME_FORMAT keyword does not apply to this variable. 2 The maximum length for a concatenated key is computed using the DBD definition. The length specified includes a 2-byte prefix containing the current length of the character string (fixed point binary). This format matches the format used by the PL/I programming language. |
Format and example of RUNDATE, TODAY, RUNTIME, and RUNDATETIME built-in variables
Built-in variable name | Format | Example |
---|---|---|
RUNDATE | ’yyyydddS’ | X’2001163F’ |
TODAY | ’yyyydddS’ | X’2001163F’ |
RUNTIME | ’hhmmssth’ | X’17171254’ |
RUNDATETIME | ’yyyydddShhmmssthmijuOFF’ | X’200163F1717125400000000’ |