SET_FLD
(Can be used in FASTREXX procedures.)
SET_FLD allows you to set a value for any field defined in a template.
- fieldname
- The name you specify must match a field name in the template. For nonunique names, you can specify a name in the form groupname.dataname. Name matching is not case-sensitive. If the name is unqualified, then the first occurrence of the name is used. For dimensioned fields, you can refer to an individual array element by providing a suffix subscript in the form (nn), where nn is a valid subscript for the dimensioned field. If you do not provide a subscript, the function applies to all elements of the array.
- value
- The value used to update the field. The value should be appropriate
for the field data type. The following can be specified:
- A hexadecimal string in the form 'hhhhhh'x. The value enclosed in quotation marks must be an even number of characters and contain valid hexadecimal characters (0–9, A–F).
- A binary string in the form 'nnnnnn'b. The value enclosed in quotation marks must be a combination of "0"s and "1"s.
- A character string. For non-numeric types, the value should be enclosed in quotation marks.
- A numeric value.
- A variable in the form &variable_name.
A variable is substituted for the value if a matching character, numeric,
or tally variable can be located. If a matching variable cannot be
found, the string is treated as a literal value.
You can refer to a substring of a variable by specifying &variable_name(n:length) which returns a string starting at the nth character of the variable for the minimum of the length specified by length or the remaining length of variable. If n is greater than the length of the variable, the value is treated as null.
- duplication
- Specify an integer n to duplicate the
literal value n times. Note: This cannot be used for numeric fields and can only be used where the value is a literal constant and not a substitute variable.
- tally_literal
- Specify a literal to appear on a tally report that counts every successful operation of the function.
Example 1
Store the value 'xxxxxxxx' in the field ST-CHAR8.
SET_FLD('st-char8','x',8)
Example 2
Store the value of variable NEW_EMP in the field EMP_NO.
SET_FLD('emp_no','&new_emp')