A system variable is a global variable that is used across all LANSA partitions. A system variable is used to store commonly used and often variable or dynamic, pieces of information.
For instance, the current date is a commonly used piece of information that varies every day. It could be assigned the system variable named *TODAYS_DATE.
Once created, this system variable name can be used in many places within LANSA:
The extensive use of system variables in validation rules has many advantages:
For instance, you could have a field named DATDUE that is only to be the current date. The required validation rule could be done in one of these ways:
While many system variables are provided with the shipped version of LANSA, their primary use is to aid in accessing your own company's information. For example, you could create the following system variables to match your company's specific requirements:
Note that the system variables listed above are not supplied with LANSA. They are suggestions for creating your own system variables.
When a system variable is defined to LANSA, the Method of Derivation must be specified. This indicates when the system variable is to be derived or evaluated. It can be specified as STATIC or DYNAMIC. In addition, the Set Value by Calling parameter identifies the name of a LANSA function or 3GL program that will "evaluate" the system variable. It is this function/ program that is important because it provides the "intelligence" required to determine the correct value to place in the system variable.
Note: System variables exist at the LANSA system level and are shared by all partitions. If the value of a system variable is changed in one LANSA partition, then all partitions will now use this new value.