REGEX='regular expression’ | REGEX=X'regular expression’

ACIF extracts the text specified by the column and length values. After the field is extracted, ACIF applies the regular expression to the text. Any text that matches the regular expression is extracted for the field. If the matching text is shorter than the length specified in the FIELD parameter, it is padded with blanks until it equals the length.

If the regular expression does not match any text in the field, the following occurs:

  • For a field based on a Group trigger the default value specified on the FIELD parameter is used. If no default value is specified, ACIF ends with error message APK488.
  • For a field based on a Float trigger, there is no error and the default value specified on the FIELD parameter is not used. In this case the load process will use the default value specified in the application.
  • 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.

See Hints and Tips Using Regular Expressions for more information about regular expression.

The regular expression must be specified in the code page given by the CPGID parameter. It can be specified in hexadecimal. The maximum length of the regular expression is 250 bytes. A mask and a regular expression cannot be specified on the same FIELD parameter.

DEFAULT='value'
Determines the default value for the index when a record is not long enough to contain the field data, or if a regular expression does not match any field data. The default value can be specified either as a character string or a hexadecimal string. If the data to be indexed is anything other than ASCII, then the default value must be specified as a hexadecimal string. For example, X'value'.

Examples: The following field parameter causes ACIF to locate field values that begin in column 83 of the same record that contains the TRIGGER1 string value. The field length is eight bytes. Specify BASE=0 because the field data always starts in the same column.

TRIGGER1=*,1,X’F1’,(TYPE=GROUP)
FIELD1=0,83,8,(TRIGGER=1,BASE=0)

The following field parameter causes ACIF to locate field values that begin ten columns offset from the trigger string value. The trigger string value can start in any column in any record. Basing the field on TRIGGER2 and specifying BASE=TRIGGER allows ACIF to locate the field by adding ten to the starting column offset of the trigger string value.

TRIGGER2=*,*,X’E2A482A396A38193’,(TYPE=FLOAT)
FIELD2=0,10,12,(TRIGGER=2,BASE=TRIGGER)

The following field parameter causes ACIF to apply the regular expression to columns 13 through 30 of the record that contains the trigger string value. Any text that matches will be extracted for the field value. This regular expression is designed to extract dates of the form “January 20, 1970”.

TRIGGER1=*,1,'1'
FIELD1=0,13,18,(REGEX='[A-Z][a-z]+ [0-9]+, [0-9]{4}')