Previous Topic

Next Topic

Book Contents

Book Index

WHEN: Rule Definition Structure

Searches for a specified string on a line-by-line basis.

Figure 278 WHEN Structure Format

Mandatory for all ON statements except ON DATA.

Note: These parameters are available for all ON statements except ON DATA.

Table 270 WHEN Structure Parameters

Parameter

Description

LINE

Line range to be searched.

FROM LINE

A 3-digit number from 001 through 999. Mandatory.

UNTIL LINE

A 3-digit number from 001 through 999, greater than or equal to FROM LINE. Mandatory.

COL

Column range to be searched.

FROM COL

A 3-digit number from 001 through 999. Mandatory.

UNTIL COL

A 3-digit number from 001 to 999, greater than or equal to FROM COL plus the length of the specified string minus 1. Mandatory.

Note: The line and column positions can also be specified using relative values (for example,  the first line of the current page, plus an offset value). For more information, see Search Areas (LINE and COL Parameters).

When search strings are joined by a Boolean operator (for example, .AND. or .OR.), the values specified in the COL parameter are ignored and data is extracted from the first column in the specified line range.

STOP

Determines if STOP criteria are to be specified:

  • blank – STOP area is not opened.
  • Y (Yes) – STOP area is opened for STOP criteria.
  • N (No) – STOP area is closed.

AND/OR

When A (And) or O (Or) is specified, an additional WHEN line is opened on the screen.

  • A – Another WHEN line is opened. The expression resolves to true only if both WHEN conditions are satisfied. Use this option when two (or more) distinct strings must be found to identify the data.
  • O – For future use.
  • N – The following WHEN line is closed.

STRING

The string to search for. The string can be up to 50 characters in length. If you need to use a longer identification string, specify another WHEN statement using the AND parameter.

The string may contain blanks. The length of the string to be located is measured from the start of the field to the last non-blank character. To search for a string with trailing blanks, embed the string in quotes (for example, ‘TRAILING BLANKS’).

STRING can contain logical comparison operators. The format of the string when it contains these operators is:

STRING =.op.string

STRING =.op.string .AND.op.string

STRING =.op.string .OR.op.string

where

STRING

(continued)

  • op is the operator. Periods on both sides of the operator are mandatory. The first op must start in the first column of the STRING field. Operators .GT., .LT., .GE., .LE., and .NE. must be followed (without extra blanks) by a string specification. The following operators are supported:

    Comparison Operators

    — .GT.–Greater than

    — .LT.–Less than

    — .GE.–Greater than or equal to

    — .LE.–Less than or equal to

    — .NE.–Not equal to

    Wild-character Mask Operator

    — .WI.–Wild-character search mask

    Location Operators

    — These operators do not require a string.

    — .AL.–All

    — .SR.–Start of report

    — .ER.–End of report

    — .SP.–Start of page

    — .EP.–End of page

    Boolean Operators

    — .AND.

    — .OR.

For additional information, see "STRING Operators" below.

One or more Boolean operators (.AND. and .OR.) can be used with comparison operators .GT., .LT., .GE., .LE., and .NE. When both .AND.s and .OR.s. are used in the same STRING parameter, the .AND. operators are evaluated (resolved) before the .OR. operators.

Examples

  • STRING=.GE.0 .AND. .LE.9
  • STRING=.NE.' TOTAL ' .AND. .NE.' SUBTOTAL '
  • STRING= MR. .OR.MS. .OR.MRS .OR.DR.
  • STRING=.NE.' ' .AND. .NE.'0'

Examples 8 and 9 below illustrate how the .AND. and .OR. Boolean operators are used to facilitate data extraction.

STRING

(continued)

  • string is the string used for comparison. The string can contain leading blanks and can be surrounded by quotes.

The comparison is performed character by character, left to right.

Note: For comparison operators, the length of the string must not exceed the length between the FROM COLUMN and UNTIL COLUMN parameters, inclusive.

STOP criteria

LINE and COL ranges to be searched and the STOP string to search for. Formats are identical to the parameters above. Optional.

Parent Topic

Rule Definition