ON MATCH

How to:

The ON MATCH command defines the action to take if the prior MATCH command succeeds (if it is able to retrieve the specified segment instance). There can be intervening commands between the MATCH and ON MATCH commands, and they can be in separate functions.

You should query the FocFetch system variable in place of issuing the ON MATCH command. FocFetch accomplishes the same thing more efficiently. For more information, see FocFetch.


Top of page

x
Syntax: How to Use the ON MATCH Command

The syntax of the ON MATCH command is

ON MATCH command

where:

command

Is the action that is taken when the prior MATCH command succeeds.

You can specify any Maintain command except for CASE, DECLARE, DESCRIBE, END, MAINTAIN, MODULE, and another ON command.



Example: Using On MATCH

The following example displays a message stating that there was a MATCH:

MATCH Emp_ID;
ON MATCH TYPE "Employee was found in the data source";

This example shows an UPDATE that is performed after a MATCH occurs:

MATCH Emp_ID;
ON MATCH UPDATE Salary FROM SalStack;

The following shows several commands being executed after a MATCH:

MATCH Emp_ID;
ON MATCH BEGIN
   TYPE "Employee was found in the data source";
   UPDATE Salary FROM Salstack;
   PERFORM Jobs;
   ENDBEGIN

WebFOCUS