The JOB_CRITERIA statement defines a regular expression used to evaluate a string returned by an SQL statement or a stored procedure.
Supported Job Types
This statement is optional for the following job types:
Syntax
This statement has the following format:
JOB_CRITERIA regexp
Defines a regular expression that is used to evaluate a return string. If the return string matches the regular expression, the job completes successfully. Otherwise, the job fails.
Limits: Up to 256 characters; case-sensitive
Note: Each return string includes the field name from the SELECT statement and its value, separated by an equal sign (=). For example, consider the query SELECT ORD_NUM FROM SALES. To match order number A2976, specify the regular expression ORD_NUM=A2976. Specifying the regular expression A2976 does not match any return string causing the job to fail. You can also specify the regular expression .*A2976, which matches any return string that ends with A2976.
Notes:
For example, to match the characters *.* literally, specify \*\.\* in your regular expression. The backward slashes escape the characters' special meanings.
Example: Define Basic Success Criteria
In the following example, if the SQL query returns a PartNo that begins with IDG, the job completes successfully.
AGENT CYBDB1 SQL 'SELECT PartNo FROM Inv_List WHERE Stock > 30' JOB_CRITERIA PartNo=IDG.*
Example: Define a More Complex Success Criteria
In the following example, if the SQL query returns an ID that matches the specified regular expression, the job completes successfully.
AGENT CYBDB1
SQL 'SELECT ID FROM Proc_List WHERE Orders > 30'
JOB_CRITERIA 'ID=\w{2,4}'
The regular expression is interpreted as follows:
To illustrate the last item {2, 4}, consider the syntax:
'ID=b1{1,3}c'
Evaluating this expression yields the following conditions:
|
Copyright © 2013 CA Technologies.
All rights reserved.
|
|