Entering criteria as a freeform expression

To enter a freeform expression:

  1. Display the Field Selection/Edit panel for your template.
  2. In either the Record Identification Criteria or Record Selection Criteria fields, enter the freeform expression.
  3. Press Enter.

    Z Data Tools evaluates the expression to see if it can be processed internally or needs to be passed to REXX. If REXX is required, the message “REXX required” is displayed in the upper right corner. You can choose to either modify the expression so that REXX is not required, or use the expression with REXX processing instead of internal processing.

  4. Press Exit (F3) to save your criteria and return to your starting panel.

A freeform expression must take the form of:

#ref comp-op value
Field that returns a value from the current record to be used in the expression. Fields are identified using the # symbol, followed by the field Reference number, for example #5.

You can also use the value returned by performing a calculation with a number of fields, for example (#5 + #6). To do this, you must embed the calculation within parentheses and use valid arithmetic operators, together with at least one field reference.

Another alternative is to use a REXX function that lists at least one field as an argument, for example MAX(#5,#6,#7).

Comparison Operator. A symbol that expresses the way in which the value derived from the field or field calculation is to be compared with value, for example the ">" symbol represents "is greater than". Z Data Tools supports all of the REXX comparison operators.
Any expression that returns a single value to be used in the criteria expression. This can take the form of a string, a numeric value, a field, a calculation that returns a value or a REXX function.

Logical operators, such as AND (&) and OR (|) can be used to create multiple criteria expressions. Parentheses can be used to control the order of evaluation in calculations and criteria expressions.

Note: At least one field reference must be made in the criteria expression. It is common practice to put this reference on the left side of the equation, although it works equally well on the right side. That is, while #5 > 100 is the more usual way of expressing this criteria, writing it as 100 <= #5 does not cause an error (note the reversal of the comparison operator). If no field reference is included, the criteria are evaluated as either true or false on their own merit and, when true, all records are returned or, when false, all records become “not-selected”.

Related concepts