Optimizing Logical Operations

A number of COBOL System Library Routines (call-by-name) are available to perform bitwise logical operations on data items. They perform operations such as AND, OR and XOR.

The Compiler recognizes calls to these routines and, if possible, optimizes them to produce in-line code rather than calls to the run-time system. In-line code is native code which performs the function directly without making any calls. The alternative is a call to a generic run-time routine which must allow for many cases.

The calls are optimized if the length is specified as a literal value. Logical AND and logical OR operations can also be carried out using the VALUE clause.