Previous Topic: Exclusive ControlNext Topic: Secondary Exclusive Control


Primary Exclusive Control

The dataview in the following example is an updateable dataview. (In all the examples that follow, 'FOR EACH DVW' can be a full FOR statement including WHERE and ORDERED BY clauses).

Example

FOR EACH DVW
        SET...
        SET...
ENDFOR

Each record is read and returned to the program one by one. Each record is read with primary exclusive control. At this point, the record is updated. While it is held under primary exclusive control, another task cannot simultaneously read the record with update intent.

Primary exclusive control is established when the record is selected as part of the set of requested records. Primary exclusive control is maintained until after the last statement in the construct before the ENDFOR. The important points to note in the above example are:

Note: This description does not apply to sequential batch processing.