ENVIRONMENT
ENVIRONMENT name TYPE type SIZE size [DESCRIPTION "description"][FORMAT "format"] [USERTEXT "user_text"] [PRECISION dec_places] [STORED store_format] [JUST just]
Arguments
name
The name of the temporary environment field to be created. It can have up to 15 characters and cannot contain spaces.
TYPE type
The data type of the environment field. Valid values are ALPHANUMERIC, NUMERIC, DATE, TIME.
SIZE size
The length of the environment field.
DESCRIPTION “description”
(optional) A description of the environment field. It can have up to 40 characters.
FORMAT “format”
(optional) The display format for the environment field. It can have up to 40 characters.
USERTEXT “user_text”
(optional) A user-defined text string associated with the environment field. It can have up to 40 characters.
PRECISION dec_places
(optional) The number of characters to the right of the decimal point in an implied-decimal environment field. If the data type is implied-decimal, this attribute must be present, and it must be less than or equal to the size of the field. Otherwise, the field is ignored.
STORED store_format
(optional) Specifies the date storage format. Valid values are:
YYPP
YYJJJ
YYMMDD (default)
YYYYPP
YYYYJJJ
YYYYMMDD
JUST just
(optional) The justification of the environment field. Valid values are:
LEFT (default for alpha, date, time, and user type fields)
CENTER (valid only for alpha and user fields)
RIGHT (default for decimal and implied-decimal fields; not allowed for alpha)
Discussion
The ENVIRONMENT statement describes a temporary environment field to be created in a report.
Environment fields are used to obtain data from the system environment. They are temporary fields that are not found in the repository. You must specify the field’s name, data type, and size. The maximum number of environment fields that can be defined in a report is 99.
If the temporary environment field does not have a unique name, it must be preceded by “TEMP.”. For example, if the temporary field is called SYSTEM and one of the selected files also contains a field called SYSTEM, you would specify the temporary field like this:
TEMP.SYSTEM
Examples
- In the example below, ENVIRON1 is the name of the field, and its size is 30. It is an alphanumeric field.
ENVIRONMENT ENVIRON1 TYPE ALPHANUMERIC SIZE 30
- In the following example, ENVIRON2 is the name of the field and its size is 6. It is a date field with the storage format YYMMDD. The format in which the field will be displayed is “MM/DD/YY.” The associated user text string is “Start Date.”
ENVIRONMENT ENVIRON2 TYPE DATE SIZE 6 FORMAT "MM/DD/YY" USERTEXT "Start Date" STORED YYMMDD