SEARCH Examples


Example 1:

 

  

SEARCH

KEYFIELD IN ITEM1 TO NUMBER WITH NDX

 

 

Variable

PL

FP

LP

Contents

Before:

KEYFIELD

10

4

6

ABCXXXGHIJ

 

ITEM1

6

1

3

123···

 

ITEM2

8

6

7

12345XXX

 

ITEM3

5

2

4

1XXX5

 

NUMBER

2

 

 

·3

 

NDX

2

 

 

·1

 

After:

NDX

2

 

 

·3

 

All other variables remain unchanged.

 

The EQUAL (or ZERO) Condition Flag is set. A match did not occur in ITEM2 because the Logical String of KEYFIELD was longer than 2 bytes.

 

Example 2:

 

 

Variable

PL

FP

LP

Contents

Before:

KEYFIELD

10

7

9

ABCDEFGXXX

 

ITEM1

7

4

5

123GXXX

 

ITEM2

8

7

8

12345XXX

 

ITEM3

5

2

5

GXXX5

 

NUMBER

2

 

 

·3

 

NDX

3

 

 

··3

 

After:

NDX

3

 

 

··0

 

All other variables remain unchanged.

 

The OVER Condition Flag is set. The Logical Strings for ITEM1 and ITEM2 (GX) were too small and the Logical String for ITEM3 (XXX5) did not match.

 

 



PL/B Language Reference SDELETE Examples SELECT Examples