MATCH Examples


Example 1:

 

  

MATCH

SENDING TO RECVING

 

 

Variable

PL

FP

LP

Contents

Before:

SENDING

12

1

5

12345ABCDE··

 

RECVING

12

6

10

ABCDE12345··

 

After:

Both variables remain unchanged.

 

The EQUAL (or ZERO) Condition Flag is set.

 

Example 2:

 

 

Variable

PL

FP

LP

Contents

Before:

SENDING

12

1

5

12345ABCDE··

 

RECVING

12

6

9

ABCDE12345··

 

After:

Both variables remain unchanged.

 

The EQUAL (or ZERO) Condition Flag is set. The LESS Condition Flag is also set because the destination field is shorter than the source field.

 

Example 3:

 

 

Variable

PL

FP

LP

Contents

Before:

SENDING

12

1

5

12345ABCDE··

 

RECVING

12

6

10

ABCDE12245··

 

After:

Both variables remain unchanged.

 

The LESS Condition Flag is set.

 

Example 4:

 

  

MATCH

"ABCD" TO RECV(4)

 

 

Variable

PL

FP

LP

Contents

Before:

RECV(4)

10

1

10

12345ABCDE

 

After:

RECV(4) remains unchanged.

 

The LESS Condition Flag is set. The hexadecimal value of numeric characters is less than that of alphabetic characters.

 

Example 5:

 

 

Variable

PL

FP

LP

Contents

Before:

RECV(4)

10

6

10

12345ABCDE

 

After:

RECV(4) remains unchanged.

 

The EQUAL (or ZERO) Condition Flag is set. The source operand was shorter than the destination operand. Therefore, the LESS Condition Flag is not set (FALSE).

 

Example 6:

 

 

Variable

PL

FP

LP

Contents

Before:

RECV(4)

10

6

10

12345ABXXX

 

After:

RECV(4) remains unchanged.

 

No Condition Flags are set (all FALSE). The first non-matching source character (C) is less than the first non-matching destination character (X).

 

Example 7:

 

  

MATCH

FIELD1 TO FIELD2 WITH "?"

 

 

Variable

PL

FP

LP

Contents

Before:

FIELD1

15

1

5

SM?TH··········

 

FIELD2

20

1

15

SMYTHE, JOHN A. ······

 

After:

Both variables remain unchanged.

 

The EQUAL (or ZERO) Condition Flag is set.

 

Example 8:

 

  

MATCH

RECORD1 TO RECORD2

 

 

Variable

PL

FP

LP

Contents

Before:

RECORD1.FIELD1

15

1

5

SMITH··········

 

RECORD1.FIELD2

20

1

7

JOHN A. ············

Before:

RECORD2.FIELD1

15

1

5

SMITH··········

 

RECORD2.FIELD2

20

1

7

JOHN A. ············

 

After:

Both RECORDs remain unchanged.

 

The EQUAL (or ZERO) Condition Flag is set.

 

Example 9:

 

  

MATCH

RECORD1 TO RECORD2

 

 

Variable

PL

FP

LP

Contents

Before:

RECORD1.FIELD1

15

1

5

SMITH··········

 

RECORD1.FIELD2

20

1

7

JOHN A. ············

 

RECORD2.FIELD1

15

1

5

SMITH··········

 

RECORD2.FIELD2

20

1

6

JOHN A. ············

 

After:

Both RECORDs remain unchanged.

 

The EQUAL (or ZERO) Condition Flag is cleared. The Logical Length of the second field is shorter in the second record.

 

 



PL/B Language Reference MACRO Example MDEFAULT Example