FLD
- B
- if the field is binary. If you specify B for type, length must be 2, 4, or 8.
- C
- if the field contains characters.
- P
- if the field is packed decimal. If you specify P for type, length must be between 1 and 16.
- Z
- if the field is zoned decimal. If you specify Z for type, length must be between 1 and 32 or, if the field contains a separate sign character, between 1 and 33.
The default value for type is C.
If you omit length and specify type P (packed decimal), FLD attempts to determine the packed field length from the record data, and returns only that field. If you omit length for other field types, FLD returns the remainder of the record.
The FLD function is similar to the built-in REXX SUBSTR function,
except that FLD interprets the substring
according to the specified
data type, and returns the value formatted appropriately. (For a numeric
field, FLD returns the value with a sign, and without leading zeros.)
Example 1
if fld(8,P) > 100 then exit 'DROP'
Example 2
19before the year field. Otherwise, insert
20.
if fld(42,2,Z) > 60 then
outrec = fld(1,41)||'19'||fld(42)
else
outrec = fld(1,41)||'20'||fld(42)