Version 8.1.4
 —  Command Reference  —

Search and Value Buffer Examples

This section contains examples of search and value buffer construction. For the Adabas file definitions used in all the examples in this section, see File Definitions Used in Examples. The values for the value buffer are shown in character and/or hexadecimal notation.


Example 1: Using a Single Search Expression

A search that uses a single search expression.

Select the ISNs of all the records in file 1 that contain the value "12345" for field AA, which has a standard length of eight bytes and numeric format.

Search Buffer
AA.
Search argument
Value Buffer character-notation
00012345
hex-notation
F0F0F0F1F2F3F4F5
Field value specification

The same search may be performed using "AA,5." (length override) in the search buffer and the value "12345" (without trailing blanks) in the value buffer.

Top of page

Example 2: Using Search Expressions Connected by AND

A search that uses two search expressions connected by the AND operator.

Select the ISNs of all the records in file 1 that contain the value "12345678" for the field AA, which has a standard length of eight bytes and numeric format, and the value "+2" for the field AB, which has a standard length of two bytes and packed decimal format.

Search Buffer
AA,D,AB.
Search argument
Value Buffer hex-notation
F1F2F3F4F5F6F7F8002C
Field value specification

Select the ISNs of all the records in file 1 that contain the value "12345678" for the field AA, which has a standard length of eight bytes and numeric format, and the value "+2" for the field AB, which has a length of three bytes (override) and unpacked decimal (override) format.

Search Buffer
AA,D,AB,3,U.
Search argument
Value Buffer character-notation
12345678002
hex-notation
F1F2F3F4F5F6F7F8F0F0F2
Field value specification

This second search produces the same result as the first search, but shows the use of the length and format override in the search buffer.

Top of page

Example 3: Using Search Expressions Connected by OR

A search that uses three search expressions connected by the OR operator.

Select the ISNs of all the records in file 2 that contain any of the values "284", "285", or "290" for the field XB. Length and format overrides are used.

Search Buffer
XB,3,U,O,XB,3,U,O,XB,3,U.
Search argument
Value Buffer character-notation
284285290
hex-notation
F2F8F4F2F8F5F2F9F0
Field value specification

Top of page

Example 4: Using Search Expressions Connected by FROM-TO

A search that uses two search expressions connected by the FROM-TO operator.

Select the ISNs of all the records in file 2 that contain any value in the range "+20" through "+30" for the field XB.

Search Buffer
XB,S,XB.
Search argument
Value Buffer hex-notation
020C030C
Field value specification

Top of page

Example 5: Using Search Expression with BUT-NOT

A search that uses three search expressions connected by the FROM-TO and BUT-NOT operators.

Select the ISNs of all the records in file 2 that contain any of the values in the range "+20" through "+30" but not "+27" for the field XB.

Search Buffer
XB,S,XB,N,XB.
Search argument
Value Buffer hex-notation
020C030C027C
Field value specification

Select the ISNs of all the records in file 2 that contain any of the values in the range "+1" through "+200" or "+500" through "+600" for the field XB.

Search Buffer
XB,S,XB,O,XB,S,XB.
Search argument
Value Buffer hex-notation
001C200C500C600C
Field value specification

Top of page

Example 6: Using a Multiple-Value Descriptor

A search in which a multiple-value field is used.

Select the ISNs of all the records in file 1 that contain the value "ABC" for any value of the multiple-value field MF.

Search Buffer
MF.
Search argument
Value Buffer character-notation
ABC 
hex-notation
C1C2C3
Field value specification

It is not possible to limit the search to a specific occurrence of a multiple-value field. The following search buffer entry is invalid:

Search Buffer
MF2.
Search argument

Top of page

Example 7: Using a Descriptor Within a Periodic Group

A search in which a descriptor within a periodic group is used.

Select the ISNs of all the records in file 1 that contain the value "4" in any occurrence of the descriptor BA (which is contained in a periodic group).

Search Buffer
BA.
Search argument
Value Buffer hex-notation
04
Field value specification

Select the ISNs of all records in file 1 that contain the value "4" in the third occurrence of the descriptor BA (which is contained within a periodic group).

Search Buffer
BA3.
Search argument
Value Buffer hex-notation
04
Field value specification

Top of page

Example 8: Using a Subdescriptor

A search that uses a subdescriptor. SA is a subdescriptor derived from the first four bytes of the field RA.

Select the ISNs of all the records in file 2 that contain the value "ABCD" for the subdescriptor SA.

Search Buffer
SA.
Search argument
Value Buffer hex-notation
C1C2C3C4
Field value specification

Top of page

Example 9: Using a Superdescriptor with Alphanumeric Format

A search that uses a superdescriptor with alphanumeric format. SB is a superdescriptor derived from the first eight bytes of the field RA and the first four bytes of the field RB.

Select the ISNs of all the records in file 2 that contain the value "ABCDEFGH1234" for the superdescriptor SB.

Search Buffer
SB.
Search argument
Value Buffer hex-notation
C1C2C3C4C5C6C7C8F1F2F3F4
Field value specification

Top of page

Example 10: Using a Superdescriptor with Binary Format

A search that uses a superdescriptor with binary format. SC is a superdescriptor derived from the fields XB and XC.

Select the ISNs of all the records in file 2 that contain the value "+20" for the field XB and the value "123456" for the field XC.

Search Buffer
SC.
Search argument
Value Buffer hex-notation
020FF1F2F3F4F5F6
Field value specification

Top of page

Example 11: Using Previously Created ISN Lists

A search that uses previously created ISN lists (identified by their command IDs).

Select the ISNs present in both ISN lists identified by the command IDs "CID1" and "CID2".

Search Buffer
(CID1),D,(CID2).
Search argument
Value Buffer not used Field value specification

Select the ISNs of all the records in file 1 for which an ISN is present in the ISN list identified by "CID1" and which contain the value "+123" for the field AB.

Search Buffer (CID1),D,AB,3,U. Search argument
Value Buffer character-notation
123
hex-notation
F1F2F3
Field value specification

Top of page

Example 12: Using a Value Operator

A search in which a value operator is used.

Select the ISNs of all the records in file 1 that contain a value greater than "+100" for the field AB.

Search Buffer
AB,3,U,GT.
Search argument
Value Buffer character-notation
100
hex-notation
F1F0F0
Field value specification

Top of page

Example 13: Using Both Value and Connecting Operators

A search in which both value and connecting operators are used.

Select the ISNs of all the records in file 1 that contain a value greater than "+100" for the field AB and a value greater than "A" for the field AA.

Search Buffer
AB,3,U,GT,D,AA,1,GT.
Search argument
Value Buffer character-notation
100A
hex-notation
F1F0F0C1
Field value specification

Top of page

Example 14: Using Physically Coupled Files

A search using search expressions that refer to physically coupled files.

Select the ISNs of all the records in file 1 that contain the value "+20" for the field AB and are coupled to records in file 2 that contain the value "ABCDE" for field RB. Length and format override are used for field AB.

Search Buffer
/1/AB,3,U,D,/2/RB.
Search argument
Value Buffer character-notation
020ABCDEbbbbb
hex-notation
F0F2F0C1C2C3C4C54040404040
Field value specification

Top of page

Example 15: Using Single Soft Coupling Criterion and Single Search Criterion

The file for which ISNs will be returned is determined by the file number field.

File Number 4  
Search Buffer
(4,AB,1,AC)/1/AB,S,AB.
Search argument
Value Buffer
-------------
Field value specification
  1. Search file 1 for AB = value as provided in value buffer.

  2. For each resulting ISN in file 1, read field AC and internally match the value with the corresponding value list for file 4. The resulting ISN list from file 4 is provided in the ISN buffer.

Top of page

Example 16: Using Single Soft Coupling Criterion and Multiple Search Criteria

The file for which ISNs will be returned is determined by the file number field. The order in which the criteria are specified is arbitrary.

File Number 1  
Search Buffer
(1,AA,2,AB)/1/AC,D,AE,D,/2/AF,S,AF.
Search argument
Value Buffer
-------------
Field value specification
  1. Search file 2 for AF = ... through ... (values in value buffer)

  2. For each resulting ISN in file 2, read field AB and internally match the value with the corresponding value list for file 1.

  3. Search file 1 for AC = ... and AE = ... (values in value buffer).

  4. Match resulting ISN lists from steps 2 and 3. The resulting ISNs are provided in the ISN buffer.

Top of page

Example 17: Using Multiple Soft Coupling Criteria and Multiple Search Criteria

File Number 1  
Search Buffer
(1,AA,2,AB; 1,AA,5,BA)
/1/AC,D,AE,D,/2/AF,S,AF,D,/5/BC,S,BC.
          
Search argument
Value Buffer
-------------
Field value specification
  1. Search file 2 for AF = ... through ... (values in value buffer).

  2. For each resulting ISN in file 2, read field AB and internally match the value with the corresponding value list for file 1.

  3. Search file 5 for BC = ... through ... (values in value buffer).

  4. For each resulting ISN in file 5, read field BA and internally match the value with the corresponding value list for file 1.

  5. Search file 1 for AC = ... and AE = ... (values in value buffer).

  6. Match resulting ISN lists from steps 2, 4 and 5. The resulting ISNs are provided in the ISN buffer.

Top of page

Example 18: Using Multiple Soft Coupling Criteria and Multiple Search Criteria with Physical Coupling

Search Buffer
(1,AA,2,AB)
/1/AC,D,AE,D,/2/AF,S,AF,D,/5/BC,S,BC.
Search argument
Value Buffer
-------------
Field value specification
  1. Search file 2 for AF = ... through ... (values in value buffer)

  2. For each resulting ISN in file 2, read field AB and internally match the value with the corresponding value list for file 1.

  3. Search file 5 for BC = ... through ... (values in value buffer)

  4. For each resulting ISN in file 5, use the physical coupling lists created by the ADAINV utility to perform ISN matching. This is done since no soft coupling criteria was provided from file 5 to the main file (file 1). If a physical coupling list does not exist, any ISNs from file 5 will not be considered.

  5. Search file 1 for AC = ... and AE = ... (values in value buffer).

  6. Match resulting ISN lists from steps 2, 4 and 5. The resulting ISNs are provided in the ISN buffer.

Top of page