Update String Formatting Rules and Examples
Consider the following rules when specifying the update text string (WS-DB-UPDATE-CMD):
-
Calculations are evaluated using standard mathematical rules, such as evaluation of expressions within parentheses first and processing multiplication before addition.
-
The text string allows any of the valid types of numeric calculations (add, subtract, multiply, divide, replace) and replacements for character strings.
-
Occurring fields may be updated.
-
Fields specified in the update string must be database fields.
-
Negative fields (for example,
-field
) may not be used. -
Use a space between entries to ensure that text is clear. Use one space between entries, and do not use tabs or new line characters.
For example, the text
EV-=’1’
could be read as
the field
EV-
set to1
– or –
the field
EV
set to(EV – 1)
Examples: Update Text String Literal Values
TOTALPAY = HOURS * ('2' + RELNAME@SUM(SALARY))
EV1 *= '17', EV6 = EV6 * (EV3REL1@SUM(EV1) + EV10[2]),
EV2 = 'RRRR'
EV10[2]
, using square brackets.
Examples: Update Text String Related Field Values
RELHR@SUM(SALARY[1])
RELHR@EMPLOYEE
Example: Setting the Text String Value
STRING
"STATUS = '4', CHECK-ID = '" DELIMITED BY SIZE
WS-U-TRD-CHECK-ID (I8) DELIMITED BY SIZE
"'" DELIMITED BY SIZE
INTO WS-DB-UPDATE-CMD