Previous Topic Next topic Print topic


Optimizing Data Manipulation and Reference Modification

Data manipulation and reference modification, and how to use 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 verb.

Do not use the INITIALIZE verb.

The STRING or UNSTRING verbs can create a large amount of code. To manipulate filenames 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