Formatted Criteria screen in field criteria


The Formatted Criteria screen is displayed when you do one of the following:

  • Select a formatted field criteria entry for a segment with a single segment layout on the Field Criteria List screen.
  • Select an entry on the Select Multiple Record Type Segment screen.

The Formatted Selection Criteria screen is used to control the selection of database segments based on field values specified using a segment layout. Each field criterion within a selection criteria is ANDed together. However, each field criterion is ORed together. Field selection criteria are then applied to segments that pass the segment selection criteria you specify.

Formatted Criteria Screen

File-AID for IMS  -----------  Formatted Criteria  ----------------- LINE 00001
COMMAND ===>                                                   SCROLL ===> CSR
Seg  ORDR010  ORDER ROOT                          Data base access: SEQUENTIAL
Criteria no. 1
-------Level number/Data-name------- -Format- RO ---------Field Value----------
01  ORDER-ROOT-DATA
  05  ORDER-ROOT-KEY
    07  ORDER-NUMBER-PREFIX          C   2  K >  AA
    07  ORDER-NUMBER                 Z   4  K
  05  ORDER-DESCRIPTION              C  40
      (POS 31-40)
  05  CUSTOMER-NUMBER                C   6    =  CN0001
  05  PLANNED-ORDER-QUANTITY         PS  5
  05  PLANNED-ORDER-AMOUNT           P   5  2
  05  ORDER-TYPE                     C   2
  05  ACTUAL-ORDER-QUANTITY          PS  5
  05  TOTAL-SCRAP-QUANTITY           PS  5
  05  TOTAL-SCRAP-REDEFINES          RDEFINES    TOTAL-SCRAP-QUANTITY
                                     C   3
  05  ORDER-STATUS                   Z   2
  05  FILLER                         C   1  

Enter END command to return to field criteria list 

Data Base Access

Indicates whether primary database root segments are accessed directly or sequentially during the extract process. For more information, see Direct Access Processing.

Level Number/Data-Name

Displays the level number and data-name of each item in the segment layout.

RO

Enter the relational operator and field value next to each field that you want to base the selection on. Leave the relational operator and the field value blank for fields not involved in the selection criterion. The RO field is protected for non-elementary items.

Multiple fields on a single criterion are logically ANDed together. Multiple sets of criteria are logically ORed together.

Fields that contain the record type are protected in the segment layout, and the intensified message "RECORD TYPE FIELD" is displayed in the Field Value field. The record type fields are treated as if you entered the EQ relational operator and the corresponding record type values. Following are the valid relational operators:

= or EQ

Equal to

Ø = or NE

Not equal to

> or GT

Greater than

< or LT

Less than

> = or GE

Greater than or equal to

< = or LE

Less than or equal to

BT

Within a range of two values (endpoints inclusive)

NB

Outside a range of two values (endpoints exclusive)

CO

Search within a field for a character string

NC

Search within a field for absence of a character string

The BT relational operator includes the endpoints of the range you specify. The NB relational operator does not include the endpoints. The BT and NB relational operators are not valid for Double-Byte Character Set (DBCS) support.

The CO and NC relational operators can be specified only for alphanumeric fields (PIC X for COBOL, CHAR or PIC for PL/I).

PL/I

EQ and NE are the only valid relational operators for bit items.

Extract based on key values

EQ is the only valid relational operator for key values.

Field Value

For fields with relational operators other than BT and NB, you specify the field value to be used in the comparison exactly as in Edit Formatted. You can enter the words HIGH-VALUES and LOW-VALUES for alphanumeric fields to represent a value of HEX FFs or HEX 00s, respectively. If you want to compare an alphanumeric field to blanks (HEX 40s) simply leave the Field Value field blank.

COBOL

For Index fields, you must enter the field value as a four-byte hexadecimal string (for example, X’41414141’).

PL/I

For Pointer and Full word Floating Binary fields, you must enter the field value as a four-byte hexadecimal string (for example, X’41414141’). For Doubleword Floating Binary fields, you must enter an eight-byte hexadecimal string (for example, X’4141414141414141’).

Formatted field criteria values can only be specified for bit items that are eight bits or less in length. The field value can contain only zeros and/or ones. The field value you specify is treated as a mask that is ANDed with the bit item when the field criteria are applied. For example, where EQ 00100010 is specified for a BIT(8) field any segment that contains a 1 bit in positions 2 and/or 6 (where the leftmost bit is position 0 and the rightmost bit is position 7) is selected. The bit values in the other positions are ignored.

Conversely, where NE 00100010 is specified any segment that contains a 0 bit in both positions 2 and 6 is selected, regardless of the values in the other positions.

You can select segments with an invalid field value by entering the word INVALID with the EQ relational operator. You can select segments with a valid field value by entering the word INVALID with the NE relational operator. You can use the word INVALID for alphanumeric, binary, packed decimal, and zoned decimal fields only. For numeric fields, any value that does not conform to the field’s data type is invalid. For alphanumeric fields, any value that contains non-displayable data is invalid.

For relational operators BT and NB, enter two values separated by a semicolon (for example, BT 0.00;9.99). In most cases you have sufficient space to enter the two values.

Relational operators CO and NC can be used to scan a field within each segment for the presence or absence of a particular character string. The string to be searched is entered in the Field Value field. Trailing blanks within the field value are ignored and are not included in the search string. To search for mixed case or lower case text, enter CAPS OFF before specifying the criteria. Only text exactly matching the upper/lower case spelling is found (for example, SMITH and Smith are different strings).

Important

COBOL Index fields and PL/I Pointer and Floating Binary fields are the only field types that you can enter hexadecimal strings for in the Field Value field.

Extract with Keys from Input File

A key file may also be used for any extract processing including secondary indexing.

When the extract is based on key values read from an input file and either the data in the data set is not in the default format or you want to supply additional selection criteria, you must specify the location, length, and type of data to be used for the key values. Specify this information in the field value with the "EQ" or "=" relational operator as follows:

INPUT(s,l,t)

s

The starting position within the logical record of the data set. This position is relative to 1.

l

The length of the data in the logical record of the data set.

t



The type of the data in the logical record of the data set.

C

Character data

X

Hexadecimal display (two characters for each byte) data

Z

Internal format data (EBCDIC)

This format of the field value is valid for the secondary index keys and keys of the FROM database root segment. If entered on another field, the value is treated as a literal.

At execution time, the data is read from the input data set and converted to the format associated with that field. The use of formatted field selection criteria allows you to specify which parts of the logical record comprise the key value and how the data is to be converted. For formatted selection criteria using character conversion type C, the data format contained in the layout determines what kind of data conversion occurs at execution time.

If the layout indicates that the field is numeric, standard numeric data conversion of display data is used to convert the input value to a value matching the internal format specified in the layout. For example, leading blanks will be replaced by zeros and zoned decimal values will be converted to zoned, packed or binary depending on the specification in the layout.

Key Value With Both INPUT And Selection Value

It is also possible to define selection criteria on a key value using both INPUT statements and selection criteria with an "EQ" or "=" relational operator (see the following figure). The key value to be used will be constructed from those portions of the key that come from the key input file and those portions that are defined to have a particular value.

Key Value With Both INPUT And Selection Value - Formatted

File-AID for IMS  -----------  Formatted Criteria  ----------------- LINE 00001
COMMAND ===>                                                   SCROLL ===> CSR
Seg  ORDR010  ORDER ROOT                          Data base access: SEQUENTIAL
Criteria no. 1
-------Level number/Data-name------- -Format- RO ---------Field Value----------
01  ORDER-ROOT-DATA
  05  ORDER-ROOT-KEY
    07  ORDER-NUMBER-PREFIX          C   2  K =  AA
    07  ORDER-NUMBER                 Z   4  K =  INPUT(12,4,Z)
  05  ORDER-DESCRIPTION              C  40
      (POS 31-40)
05 CUSTOMER NUMBER

Key input files may be combined for use with root keys or secondary index key fields.

Examples of Input Statements

Scenario 1

You have a database with the key field being defined as length 4, and unsigned numeric, equivalent to COBOL PIC 9(4). You also have a corresponding database root segment with a value of 22. The relevant INPUT statements and corresponding key file values (starting in column 10) would be:

Statement

Key file value

INPUT(10,4,C)

0022 (or two blanks followed by 22)

INPUT(10,8,X)
F0F0F2F2
INPUT(10,4,Z)
0022

Important

The C format example will be the same, no matter what the database field format is.

Scenario 2

Scenario 2 is similar to Scenario 1, with the difference being that the database key field is defined as length 4 packed signed numeric, equivalent to COBOL PIC S9(7) COMP-3. The relevant X & Z INPUT statements and corresponding key file values would be (with the Z values shown in Hex format):

Statement

Key file value

INPUT(10,8,X)
0000022C
INPUT(10,4,Z)
0002
002C

Scenario 3

Scenario 3 is similar to Scenario 1, but now the layout indicates the field is unsigned binary, equivalent to COBOL PIC 9(9) COMP. Suppose the display value of the key is 123456789, then the relevant X & Z INPUT statements and corresponding key file values are:

Statement

Key file value

INPUT(10,8,X)
75BCD15F
INPUT(10,4,Z)
7BD5
5C1F

Important

The Z format key file values must match the internal representation of the value on the database.

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*