3 5 1 System Variable Concepts

Visual LANSA

3.5.1 System Variable Concepts

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:

  • As a field's default value in the repository.
  • In any of the 6 standard types of field validation rules.
  • Just about anywhere in the RDML components of LANSA.

The extensive use of system variables in validation rules has many advantages:

  • The validation rules are simpler and easier to understand.
  • The validation rules are more powerful and more accurate.
  • The validation rules last longer and are easier to maintain.

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:

  • As a range of values rule. Validate DATDUE as being in range *TODAYS_DATE to *TODAYS_DATE.
  • As a list of values rule. Validate DATEDUE as being in the list *TODAYS_DATE.
  • As a simple logic rule. Validate DATDUE by evaluating the expression '#DATDUE = *TODAYS_DATE'.

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:

System Variable

Description

Type

Len

Dec

*PERIOD

Current financial period

N

4

0

*LASTPERIOD

Last financial period

N

4

0

*NEXTPERIOD

Next financial period

N

4

0

*BEGINMONTH

Date of first day of current month

N

6

0

*ENDMONTH

Date of last day of current month

N

6

0

*SYDOFFICE

Sydney office name and address code

A

7

 

*MEBOFFICE

Melbourne office name and address code

A

7

 

*COMPANY

Company number for use in G/Ledger

A

2

 

 

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.

 

Ý 3.5 System & Multilingual Variables Development