Previous Topic: SELECT / BYPASS—OverviewNext Topic: Examples of Coding Input Definition Parameters


SELECT / BYPASS Parameters

More information:

SELECT / BYPASS Parameters

Purpose

SEL/BYP parameters establish selection criteria that are applied to input records at run time.

Syntax

       Col
       2
       ▼
►►──┬─ SELect ─┬─┬──────────┬── when boolean-expression ──────────────────────►◄
    └─ BYPass ─┘ └─ BUFFER ─┘

Expansion of Boolean-expression

   ┌───────────────────────────┬─ AND ─┬────────────────────────────────────┐
   │                           └─ OR ──┘                                    │
►►─▼─┬ literal ──────────────┬ test-operation ─┬┬─ NUMERIC ───────────────┬┬┴─►◄
     └ field-name-expression ┘                 │├─ literal ───────────────┤│
                                               │└─ field-name-expression ─┘│
                                               └ ( field-name-range ) ─────┘

Expansion of Field-name-expression

►►──── field-name ──┬─────────────────────────┬───────────────────────────────►◄
                    ├─ .subscript-value ──────┤
                    └─ .subscript-field-name ─┘

Expansion of Field-name-range

►►──┬─ literal ───────────────┬─ TO ──┬─ literal ───────────────┬─────────────►◄
    └─ field-name-expression ─┘       └─ field-name-expression ─┘

Syntax Rules

SELect/BYPass

Identifies the parameter type. One of these keywords must be coded starting in column 2.

BUFFER

Directs CA Culprit to apply selection criteria defined on this parameter on the completed input buffer. This option is generally used after the matching logic of a match-file run resolves the contents of the input buffer.

WHEN

An optional keyword placed before the test conditions.

boolean-expression

Represents the expanded syntax shown below. CA Culprit tests this expression at run time when it retrieves a record or fills an input buffer. If the tested expression is true, CA Culprit selects or bypasses the record or buffer, as determined by the parameter type (SELECT or BYPASS).

literal

Specifies the value of the left operand to be compared:

Literal

Meaning

alphanumeric

A 1- to 64-character alphanumeric value, enclosed in single quotation marks, that consists of letters, numbers, and special characters in any combination. To express an apostrophe (a single quotation mark), code two consecutive single quotation marks; for example, 'ERNIE''S DINER'.

numeric

A 1- to 31-digit numeric value, optionally preceded by a sign and optionally containing an embedded or trailing decimal point; for example, 12.34.

hexadecimal

A 1- to 50-character (25 byte) hexadecimal value, preceded by X and enclosed in single quotation marks; for example, X'0000'.

field-name-expression

Specifies a field name value in the left operand that is to be compared. See expanded syntax for field-name-expression below.

field-name-range

Identifies a range of values to be compared. See the syntax diagram above.

The value of the left operand can be tested for an EQ or NE condition against the range of values.

Expansion of Field-name-expression

field-name

Identifies the name of either a singly- or multiply-occurring input field defined on a REC parameter or a global work field defined on a work field parameter.

subscript-value

A numeric literal that identifies a specific occurrence; for example, ACCOUNT-NUMBER.4 identifies the fourth occurrence of ACCOUNT-NUMBER.

subscript-field-name

The name of a singly-occurring input field or global work field whose value identifies the specific occurrence; for example, if INDX is assigned a value of 2, then ACCOUNT-NUMBER.INDX identifies the second occurrence of ACCOUNT-NUMBER. The definition of a field that acts as a subscript must not specify a decimal point.

A subscript value must be separated from the name of the multiply-occurring field by a period (.). Subscript values should not exceed the number of field repetitions. For example, if ACCOUNT-NUMBER occurs ten times, the subscript value should be a number in the range 1 through 10. The value of the subscript can be tested in procedure logic.

test-operation

The comparison operator for boolean expression. It indicates the type of test to be performed:

Symbol

Synonym

What it means

EQ

E or=

Indicates the values of the left and right operands are equal.

NE

N or #

Indicates the values of the left and right operands are not equal.

GT

H or >

Indicates the value of the left operand is greater than the value of the right operand.

LT

L or <

Indicates the value of the left operand is less than the value of the right operand.

GE

>= or =>

Indicates the value of the left operand is greater than or equal to the value of the right operand.

LE

<= or =<

Indicates the value of the left operand is less than or equal to the value of the right operand.

A maximum of 32 test conditions can be defined on a single SELECT/BYPASS parameter. One or more test conditions can be enclosed in parentheses. CA Culprit evaluates expressions within parentheses before evaluating expressions not enclosed in parentheses.

NUMERIC

A keyword value for the right operand. NUMERIC indicates that the value of the left operand is to be tested for numeric data. Valid test operations with this keyword are EQ and NE. An EQ test is true if the value of the left operand is numeric; a NE test is true if the value of the left operand is not numeric. If nonnumeric data is discovered, the record that contains the nonnumeric data can be dropped from further processing to avoid a data exception.

Data defined as zoned decimal is treated as numeric unless one of the following conditions applies:

The conditions stated above imply that zoned decimal fields that contain exclusively alphabetic data are interpreted as numeric. For example, the character string ABC is represented in hexadecimal as C1C2C3, which is the equivalent of +123.

literal/field-name-expression

Identifies a single value or a list of values to be compared in the right operand.

A list of values must be enclosed in parentheses; a comma or space must separate each listed value. An EQ test condition implies an OR connector between the list of values; a NE test condition implies an AND connector between the list of values.

AND/OR

Logically connects complex selection criteria. With AND, both conditions must be true; with OR, one condition must be true.

CA Culprit breaks down complex selection criteria into simple statements; these statements appear on the Input Parameter Listing as shown in the screen capture which follows below. In compound expressions, CA Culprit evaluates tests joined by AND before tests joined by OR. Multiple AND or OR connectors are evaluated from left to right.

If more than one SELECT (or BYPASS) parameter is defined for the same file, CA Culprit evaluates these statements as though they were connected by OR. In boolean expressions that contain a list of field names or literals, an EQ test condition implies an OR connector between the list of values; a NE test condition implies an AND connector between the list of values.

Input Parameter Listing of a SELECT Operation:

mm/dd/yy INPUT PARAMETER LISTING Vnn.n PAGE 2 ******** SEL/BYP REF CONDITION ******** SEL $ SALARY EQ (35000 TO 55000) ──┬── User input SEL $ OR SALARY LE 15000 ──┘ SEL 00001 SALARY GE 35000 ──┐ SEL 00002 SALARY LE 55000 ├── CA-Culprit's interpretation SEL 00003 SALARY LE 15000 ──┘ of SEL criteria

Note: CA Culprit resolves complex selection criteria into simple statements.

Examples

Sample SELECT/BYPASS parameters are described below.

Example 1

SELECT (COMPANY EQ 'A' OR BRANCH EQ 35) AND STATUS NE 'L'

CA Culprit selects for report processing only those records for company A or for branch 35 whose status is not L.

An alternative method for selecting the same records for report processing appears below:

BYPASS (COMPANY NE 'A' AND BRANCH NE 35) OR STATUS EQ 'L'

Example 2

SELECT  OUT-BAL GE 1000.00
SELECT  AGE GT 60 AND OUT-BAL GT 500.00

Records with an outstanding balance greater than or equal to $1000.00 or with accounts older than 60 days and outstanding balances greater than $500.00 are selected.

Example 3

BYPASS CUSTOMER-ACCOUNT-NUMBER  EQ  (500000 TO 599999)

All records with account numbers in the range 500000 through 599999 are eliminated from further processing.

Example 4

SELECT  BUFFER  WHEN  FILE1-DATE EQ FILE2-DATE

After matching logic constructs the input buffer, records are selected when the contents of the FILE1-DATE field are equal to the contents of the FILE2-DATE field.