Using VOLATILE clauses efficiently
Optimization of data items that are defined with the VOLATILE
clause
is significantly restricted. Therefore, use the VOLATILE
clause
only when appropriate.
In particular, it is important to understand
that when
the VOLATILE
clause is used on a group item, the
compiler treats all data items subordinate to the group item as volatile,
and all higher-level group items that contain the volatile group item
are treated as volatile, too. If a particular member of a group needs
to be treated as volatile, specify the VOLATILE
clause
on the data description entry for that item only, where possible.
At
present, the primary reason to use the VOLATILE
clause
is for data items that are set or referenced inside an LE condition
handler but are defined outside the LE condition handler program.
The VOLATILE
clause guarantees that such items are
handled correctly by the optimizer. For more information on when to
use VOLATILE
, see VOLATILE clause in
the Enterprise COBOL for z/OS® Language Reference.