Entering criteria as a freeform expression
To enter a freeform expression:
- Display the Field Selection/Edit panel for your template.
- In either the Record Identification Criteria or Record Selection Criteria fields, enter the freeform expression.
- Press Enter.
File Manager 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.
- 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
- #ref
- 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).
- comp-op
- 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". File Manager supports all of the REXX comparison operators.
- value
- 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.
#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