Previous Topic Next topic Print topic


Optimizing Data Manipulation and Reference Modification

When using the MOVE, INITIALIZE, STRING and UNSTRING statements, reference modified fields are optimized if coded in one of the following forms:

item (literal:)
item (literal:literal)
item (literal:variable)
item (variable:variable)
item (variable + literal:literal)
item (variable - literal:literal)
item (variable + literal:variable)
item (variable - literal:variable)

Other forms of reference modification are inefficient.

If the offset or length of the reference modification is a data item, use a COMP-5 item of the smallest optimum size (one, two or four bytes) that accommodates the range of values involved. Define it in the Working-Storage Section. With this COBOL system, use a four-byte COMP-5 item.

In a MOVE statement, the source item should be the same size as, or larger than, the target. This prevents space-padding code from being generated.

If you try to implement a MOVE between two numeric-edited items, the result is undefined although no error status is returned.

Do not use the CORRESPONDING option of the MOVE statement.

Do not use the INITIALIZE statement.

The STRING or UNSTRING statements can create a large amount of code; therefore, to manipulate file names, use the COBOL system library routines CBL_SPLIT_FILENAME and CBL_JOIN_FILENAME. For other purposes, create your own loops as they are almost always more efficient.

Previous Topic Next topic Print topic