3.15.6 Mathematical Calculation of a Field
This screen is displayed when the option to perform a Mathematical calculation for a virtual field has been chosen from the Virtual field extended definition action box.
|
Working from the Mathematical calculation of a field screen you can:
- Review the mathematical calculation extended definition of the virtual field currently being worked with.
- Specify the mathematical calculation extended definition of the virtual field currently being worked with.
- Change the mathematical calculation extended definition of the virtual field currently being worked with.
- Delete the mathematical calculation extended definition of the virtual field currently being worked with. There is no confirm option when delete has been specified for a virtual field extended definition.
Input Options
File
Is the name of the physical file currently being worked with.
Virtual Field
Is the name of the "virtual" field within the physical file currently being worked with. The value of the "virtual" field will be the result of the mathematical calculation of the fields specified in the "calculation specification" list. The "virtual" field must be a numeric data type, either packed or signed. The "virtual" field must be large enough to contain the result of the mathematical calculation otherwise unpredictable results could occur.
Derive "Virtual" Field on Input From File
Specifies whether the "virtual" field should be derived from the file on input. Valid entries are "YES" or "NO".
Value 1
Specifies the name of a field ("real" or "virtual" field name within this file), a valid numeric literal or an *WORKnnnnn field. This is an optional entry for all operation codes, except for when the operation code of "S" is specified, in this case the "Value 1" field must be blank. If a field name has been specified its data type must be either packed or signed.
By entering a '?' the single field selection screen is displayed. The selection list will be built from all the real and virtual fields in the current file's definition. Refer to 3.10.1 Select Fields When Working from File Definition Menu for more details.
Operation
Specifies the operation to be performed for the calculation line. Valid entries are:
"+" |
Add |
"-" |
Subtract |
"/" |
Divide |
"*" |
Multiply |
"S" |
Set |
Note: If the operation for a calculation line is '/' (Divide) a check will be automatically performed to ensure "Divide by zero" errors are prevented.
If the value within "Value 2" is 0 the "Result" value will be automatically set to 0, if the value within "Value 2" is not 0 then the '/' (Divide) operation will be performed.
Value 2
Specifies the name of a field ("real" or "virtual" field name within this file), a valid numeric literal or an *WORKnnnnn field. This is a mandatory entry for all operation codes, except for when the operation code of "S" is specified, in this case the "Value 2" is optional. If the operation code is "S" and "Value 2" is blank the system will automatically set "Value 2" to 0. If a field name has been specified its data type must be either packed or signed.
By entering a '?' the single field selection screen is displayed. The selection list will be built from all the real and virtual fields in the current file's definition. Refer to 3.10.1 Select Fields When Working from File Definition Menu for more details.
Result
Specifies the name of the "virtual" field or a *WORKnnnnn field. This is a mandatory entry.
Note:
- The *WORKnnnnn fields are exclusively reserved for use in "virtual" code extended definition "mathematical calculations" only.
- The *WORKnnnnn fields do not have to be defined within LANSA, the *WORKnnnnn field length will be automatically assumed to be 30,9.
- All *WORKnnnnn fields that are used in a "mathematical calculation" are automatically initialised before the first time they are used.
- Multiple *WORKnnnnn fields can be used in "mathematical calculations" simply by replacing the "nnnnn" portion of the work field name with a unique replacement value, for example: *WORK00001, *WORK00002, *WORKTOT01 etc.
- If *WORKnnnnn fields with the same name are used in other virtual field "mathematical calculations" their values will not be carried forward to the next virtual field's mathematical calculation.