Rational Developer for System z
Enterprise COBOL for z/OS, Version 4.1, Compiler and Runtime Migration Guide


Upgrading programs that have SEARCH ALL statements

This section describes the actions that you need to take for certain programs that have SEARCH ALL statements and that were compiled with one of the following compilers: These actions are required due to changes in the behavior of the SEARCH ALL statement between the above listed compilers and the following compilers:

These two compilers have the same behavior for the SEARCH ALL statement, and this section refers to both of the newer compilers as Enterprise COBOL V4R1.

Enterprise COBOL V4R1 corrects errors in the implementation of the SEARCH ALL statement. SEARCH ALL statements in earlier releases of COBOL contained errors in the key comparison logic, which caused different results than might have been intended. In particular, the comparison did not produce the same result as an IF statement or a sequential SEARCH statement.

Length mismatch problem: a search argument is longer than the table key

The SEARCH ALL statement comparisons should pad an alphanumeric key with blanks or extend a numeric key with leading zeros if the key is shorter than the SEARCH argument. However, in V3R3 and earlier releases, SEARCH ALL ignored the excess characters in the argument in some cases. For example, an alphanumeric search argument of 01 ARG PIC X(6) containing "ABCDEF" would incorrectly match a table or array key of 05 MY-KEY PIC X(4) with value "ABCD". A search argument containing "ABCD??" (where ? is a blank) would match, as expected.

Similar problems occurred with a numeric search argument and keys. For example, a search argument of 01 ARG PIC 9(6) containing 123456 would incorrectly match a table or array key of 05 MY-KEY PIC 9(4) with value 3456. A search argument containing 003456 would match, as expected.

Sign mismatch problem: signed numeric argument and unsigned numeric key

A second problem occurs when the search argument is a signed numeric item and the table key is an unsigned numeric item. If the runtime value of the search argument is negative, such as -1234, programs compiled with V3R3 and earlier would match a table key of 1234. These comparisons should be done using the rules for a normal COBOL relation condition, and a negative argument such as -1234 should never match a table key that is unsigned.

The correction:

Enterprise COBOL V4R1 corrects these problems. However, some applications compiled with earlier releases might depend on the incorrect behavior. You must identify and modify these applications before you move them to Enterprise COBOL V4R1.

To assist you in identifying the programs and SEARCH ALL statements that are impacted by these corrections, the following compiler and runtime warning diagnostics are issued.

To migrate to Version 4:

To move an application to Enterprise COBOL V4R1, do one of the following sets of steps:

After you have identified which of the SEARCH ALL statements are affected, adjust the application logic appropriately by doing the following steps:


Terms of use | Feedback

This information center is powered by Eclipse technology. (http://www.eclipse.org)