Default values for fields
If the regular expression does not match any text in the field, a default value might be used. Whether a default value is used and which type of default value depends on the type of field. There are three types of fields: fields based on group triggers, fields based on floating triggers, and transaction fields.
Group field
- If a regular expression does not match any text in the group field, the default value specified on the FIELD parameter is used. If no default value is specified, ACIF ends with error message APK488.
- If the record is only long enough to contain part of the field, the regular expression is applied only to the portion of the record that is present.
- If the record is not long enough to contain even the first byte of the field, the default value specified on the FIELD parameter is used. If no default value is specified, ACIF ends with error message APK449.
Floating field
- If a regular expression does not match any text in the floating field, there is no error and the default value specified on the FIELD parameter is not used.
- If the record is only long enough to contain part of the field, the regular expression is applied only to the portion of the record that is present.
- If the record is not long enough to contain even the first byte of the field, the default value specified on the FIELD parameter is used. If no default value is specified, ACIF ends with error message APK449.
- In the case of (1) the load process can use the default value in the Application. The other case where the load process uses the default value in the Application is when a floating trigger is not found within a group. Since the trigger is not found, there is no field for that group.
Transaction field (grouprange or pagerange field)
- If the regular expression does not match any text in the transaction field, there is no error and processing continues. A default value cannot be specified for a transaction field.
- If the record is not long enough to contain the entire field, no field is collected. There are no errors and processing continues.
Examples
Using a regular expression for
a trigger:
TRIGGER1=*,1,REGEX='P[A-Z]{3} ',(TYPE=GROUP)This
regular expression will match text that begins in column 1 with the
letter 'P' and is followed by three uppercase letters followed by
a space. For example: "PAGE "Using
a regular expression to extract a date in the form of "July 4, 1956":
TRIGGER1=*,1,'1'
FIELD1=0,13,18,(REGEX='[A-Z][a-z]+ [0-9]+, [0-9]{4}',DEFAULT='January 1, 1970')
INDEX1='Date',FIELD1Using a regular expression
with a transaction field to extract a range of Social Security numbers:
TRIGGER1=*,1,'1'
FIELD1=0,30,3
FIELD2=*,*,12,(OFFSET=(59:70),ORDER=BYROW,REGEX='[0-9]{3}-[0-9]{2}-[0-9]{4}')
INDEX1='DEPT',FIELD1,(TYPE=GROUP)
INDEX2='SOCIAL SECURITY NUMBER',FIELD2,(TYPE=GROUPRANGE)