HELP: Byte-pattern match for content validation TYPE: OBJECT SYNTAX: MATCH(OFFSET=num,LENGTH=num,DATA='bin-hex',MASK='bin-hex',NEGATE,FMTERR,IGNREC)
This object activates byte-pattern validation of the raw or base-decoded bytes of a binary column. It is the binary-typed counterpart of REGEXP: REGEXP matches the textual representation of a column against a regular expression; MATCH compares a fixed byte pattern against the binary content with an optional AND mask and an optional NEGATE flag.
MATCH is the preferred disambiguation mechanism for segment codes in mainframe unload formats (e.g. the two-byte SEG-CODE prefix of an IMS HD Unload record) because it works on the untransformed bytes and does not require a codepage conversion.
A MATCH object carries the following parameters:
OFFSET Byte offset within the column where the comparison starts (default 0 = start of the column).
LENGTH Number of bytes to compare. When omitted, the DATA length is used. LENGTH must either be zero or equal to the DATA length.
DATA Hexadecimal byte pattern to match against the input. This parameter is mandatory.
MASK Optional byte-wise AND mask of the same length as DATA. Before the comparison both the input bytes and the DATA bytes are AND-ed with the mask. Use this to match a family of values (for example all segment codes whose high byte is 0x01).
NEGATE When set, the MATCH succeeds on a byte mismatch instead of a byte equality. Useful for catch-all columns that should react to every value except a fixed set.
FMTERR Return a format error on mismatch. This lets the surrounding row-probe loop fall through to the next row specification. Mutually exclusive with IGNREC.
IGNREC Silently drop the complete record on mismatch (the record counter for ignored records is increased). Mutually exclusive with FMTERR.
Multiple MATCH objects may be supplied on the same column. They are evaluated in order and the column is accepted only when ALL MATCH objects succeed (AND combination).
By default (neither FMTERR nor IGNREC set) a mismatch raises a hard match-validation error (FLMRTC_MCH) that aborts the running operation, analogous to the default behaviour of REGEXP.
NUMBER: OFFSET=num - Byte offset within the column where matching starts [0]NUMBER: LENGTH=num - Number of bytes to compare [0 = use DATA length]STRING: DATA='bin-hex' - Binary pattern to match (hexadecimal)STRING: MASK='bin-hex' - AND mask applied before compare; must equal DATA length [absent = no mask]SWITCH: NEGATE - Match when bytes do NOT equal DATA [FALSE]SWITCH: FMTERR - Return a format error (row fall-through) if no match [FALSE = abort with MCH]SWITCH: IGNREC - Silently drop the record if no match [FALSE]