In this section: How to: Reference: |
In response to a MATCH command, the adapter selects the first row in the table that meets the MATCH criteria.
The MATCH command compares incoming data with one or more field values and then performs actions that depend on whether or not a row with matching field values exists in the table.
The syntax of the MATCH command in MODIFY is
MATCH field1 [field2...fieldn] ON MATCH action_1 ON NOMATCH action_2
where:
Are fields representing columns. FOCUS compares incoming data values against existing column values. The fields can be any combination of key and/or non-key fields. Specify complete fieldnames. MATCH does not support truncated names.
Is the operation to perform when the values in a row match the incoming data values.
Is the operation to perform when the existing values in a row do not match the incoming data values.
Your FOCUS documentation on maintaining databases discusses these actions in detail.
MATCH processing for multi-table Master Files is the same as for a multi-segment FOCUS data source.
In Maintain, you do not have to include an ON NOMATCH command in order to reject a transaction. Maintain automatically rejects a transaction that does not satisfy the MATCH criteria. See your FOCUS documentation on maintaining databases for MATCH syntax in Maintain.
Acceptable actions for MATCH commands fall into eight groups. They are operations that:
In MODIFY requests, there are two major differences in the way MATCH commands function for the adapter and for native FOCUS:
For example, if the primary key is EMP_ID and the incoming value for MATCH LAST_NAME is SMITH, the answer set contains all rows with last name SMITH.
Note: In Maintain, MATCH functions identically for the adapter and for native FOCUS.
Consider a MODIFY request that maintains the EMPINFO table. It prompts for an employee ID and for a new salary. Then it processes the incoming data. The annotated request contains the following MATCH commands:
MODIFY FILE EMPINFO PROMPT EMP_ID CURRENT_SALARY 1. MATCH EMP_ID 2. ON MATCH UPDATE CURRENT_SALARY 3. ON NOMATCH REJECT DATA
The incoming transaction contains the following values:
EMP_ID = 123456789 CURRENT_SALARY = 20000
The request processes as follows:
Information Builders |