2 16 2 Create a New System Variable

LANSA for i

2.16.2 Create a New System Variable

When the option to create a new system variable is chosen from the field control menu this format is displayed until the EXIT or MENU/CANCEL function key is used:

 

 DC@P100303             Add System Variable Definition                 

 

 System wide variable name. . . . . ____________________               

 

 Description  . . . . . . . . . . . _________________________________  

 

 Method of derivation . . . . . . . STATIC    STATIC, DYNAMIC          

 

 Data type  . . . . . . . . . . . . ALPHA     ALPHA, NUMBER            

 

 Length / Total digits  . . . . . . ___                                

 

 Decimal Positions  . . . . . . . . _                                  

 

 Set value by calling program . . . ______   Type  . . . . . __   FUN  

                                                                  3GL  

 

 Initial public access  . . . . . . NORMAL (ALL, NORMAL, NONE)         

 

 

 Fnn=Help  Fnn=Exit  Fnn=Cancel  Fnn=Messages                          

 

 

 

Input Options

These input options apply to the creation or amendment of a system variable definition:

System Wide Variable Name

This is the symbolic name of the system variable. It must:

  • Begin with a "*" (asterisk).
  • At least 4 characters in length.
  • Not contain imbedded blanks.
  • Not be *ALL, *ALL_REAL, *ALL_VIRT, *DEFAULT, *EXCLUDING, *HIVAL, *INCLUDING, *LOVAL, *NAVAIL, or *NULL as these values are reserved by LANSA.
  • Not begin with *MTXT because this prefix is reserved for multilingual variables.

Description

Mandatory. Enter a brief description of what the system variable is or represents to aid other users of the system.

Method of Derivation

Mandatory. Default value is STATIC. Specifies how LANSA is to derive the system variable within a file I/O module or user written function that references it. Allowable values are:

STATIC

The system variable is a static value, therefore its value can be derived once (during program initialisation) by LANSA. Examples of static system variables would include the current job name, the current user name and most probably the current date (providing that applications do not normally span midnight while executing).

DYNAMIC

The system variable is a dynamic value, therefore its value must be derived each and every time it is referenced. Examples of dynamic system variables would include the current time, the current output queue name and library and all user defined system variables that "allocate" values such as the next invoice number, the next batch number, etc.

Note that every time a dynamic system variable is referenced the associated evaluation program is called to "refresh" the system variable. Excessive use of dynamic system variables with complex evaluation programs may degrade LANSA performance.

 

Data Type

Mandatory. Allowable values are:

ALPHA

System variable is alphanumeric.

NUMBER

System variable is numeric. Use of this option in fact nominates the system variable as a packed decimal variable.

 

Length/Total Digits

Specifies the number of characters in an alpha system variable. Specifies the total number of digits (including decimals) in a numeric system variable.

  • Must be in range 1 to 256 for type ALPHA.
  • Must be in range 1 to 30 for type NUMBER.

Decimal Positions

Specifies the number of decimals in a numeric type system variable. Only valid for type NUMBER. Ignored for type ALPHA. Must be in range 0 to 9 and less than or equal to total digits.

Set Value by Calling Program

Specifies the name of the LANSA function or 3GL program that is to be called to set the value of the system variable.

The name of a LANSA function or 3GL program must be specified. Note that if a LANSA function is specified, LANSA checks that the function name does not exceed 7 characters- but does not check that the function actually exists. The function should be able to be located in the user's library list at the time the system variable is evaluated.

Note also that if a 3GL type program is specified, LANSA checks that the name specified is a valid program name, but does not check that the program actually exists.

Note also that the program should be able to be located in the user's library list at the time the system variable is evaluated. For more information refer to System Variable Evaluation Programs in the Visual LANSA Developer Guide.

Type

Specifies whether the variable is to be evaluated by a LANSA function or a 3GL program.

Initial Public Access:

This is mandatory, but always pre-filled to NORMAL.

Allowable values are:

NORMAL

Other users can use this system variable, but cannot change or delete its definition in/from the data dictionary.

ALL

Other users can use this system variable and can also change or delete its definition in/from the data dictionary.

NONE

Other users cannot use this system variable, nor can they review, change or delete its definition in/from the data dictionary.