Operations on numeric fields
Operations on numeric fields are performed individually and the calculation precision is determined by the size of the resulting field.
= – Assignment
This assigns a value to a numeric field.
The source and destination of numeric fields may be of different nature and the value is converted when assigned.
FieldR = Field1/Constant/N@n/Null
FieldR receives the contents of field1 with conversion if necessary.
Example :
O.Indice = I.Ind
O.Indice = 100
O.Indice = Null
Compute – Add, subtract, multiply, divide and remainder of division
This computes two values and enters the result in a field. The resulting field may be one of the initial fields.
The source and destination numeric fields may be of different natures and the value is converted when assigned.
+: Add Field1 and Field2 to FieldR.
FieldR = Field1 + Field2/Constant/N@n
-: Substract Field2 from Field1 to FieldR.
FieldR = Field1 - Field2/Constant/N@n
*: Multiply Field1 with Field2 to FieldR.
FieldR = Field1 * Field2/Constant/N@n
/: Divide Field1 by Field2 to FieldR.
FieldR = Field1 / Field2/Constant/N@n
\: Divide Field1 by Field2 and put the remainder to FieldR.
FieldR = Field1 \ Field2/Constant/N@n
STR – Convert numeric to alpha (non-AS/400 IBMi)
This is available only on non-AS/400 IBMi sources.
Places the result of a numeric to alpha conversion in a field.
STR b.Field1/N@n TO b.Field2
DCL W.Field_1 NUMERIC 9,2
DCL W.Field_2 CHAR 15
W.Field_1 = -15.2
STR W.Field_1 TO W.Field_2
TRACE W.field_2
-00000000015.20 trace