Defining new expert rules
You can define new expert rules variables (facts) by creating a REXX EXEC. Common Explain creates the set of rules variables based on the SQL statement that is being explained. You can set new values for those variables and you can make your own variables.
To define new expert rules
Using a text editor, create a REXX exec.
Save the edited REXX exec as a member of the same data set as the rule sets.
The name of the member must be PSSREXIT.
If PSSREXIT exists in the data set, Common Explain executes the REXX exec before running the rules engine. The REXX exec replaces and adds variable values to which the rules engine subsequently refers.
REXX exec can call the following functions:
- SETS and SETF functions take two arguments, the variable name and the variable value.
- GETS and GETF functions take one argument, the variable name.
- PSSRXSQL function takes one argument, an SQL statement.
By calling the PSSRXSQL function, the REXX exec can perform the following SQL statements:
- FETCH INTO
- SELECT INTO
- COMMIT
- ROLLBACK
- OPEN
- CLOSE
- EXECUTE IMMEDIATE (for executing INSERT, UPDATE, or DELETE SQL statements)
PSSRXSQL sets the following REXX variables after executing an SQL statement:
- SQLCODE
- SQLSTATE
- SQLERRM (contains the text of an error message)
- “INTO” variables
- cursor_name.n variables
This section contains the following topics:
Related topic