Technical data
Figure 6–4 After Modifying MEMBER_B and Using RETAINING
SORT−OWNER
MEMBER−A KEY 1 MEMBER−D KEY 9
MEMBER−B KEY 8
POSTION VACATED
BY MEMBER−B
(CURRENT OF SET)
MEMBER−C KEY 6
ZK−1512−GE
If MEMBER_B’s key was changed to KEY 4, the record’s position in the set
occurrence would not change, and a FETCH NEXT WITHIN SORT_SET would
fetch MEMBER_C.
6.6 CONNECT and DISCONNECT
When the set membership class is MANUAL, use the CONNECT statement
to link a member record to its set occurrence. You can also use CONNECT for
AUTOMATIC sets, provided that the retention class is OPTIONAL and you have
disconnected the record.
When you use the CONNECT statement, specify the set or sets where the record
is to be connected. Executing a CONNECT statement without the set list clause
connects the record to all sets in which it can be, but is not yet, a member.
Before you execute a CONNECT statement, be sure that currency for the
specified set type points to the correct set occurrence. If not, the member record
will participate in the wrong set occurrence. (For more information on currency,
see Section 5.13 and Section 5.14.) You cannot execute a CONNECT for a record
that participates as an owner of the specified set.
If the set retention class is OPTIONAL, use the DISCONNECT statement to
remove a member record from a specified set. The DISCONNECT statement does
not delete a record from the database.
When you use the DISCONNECT statement, specify the sets from which the
record will be disconnected. Executing a DISCONNECT without the set list
clause disconnects the record from all the sets in which it participates as
an optional member. You cannot execute a DISCONNECT for a record that
participates as an owner of the specified set or that has a set retention class of
FIXED or MANDATORY. Refer to the Section 4.7 for an explanation of how set
membership class affects certain DML verbs.
6–8 DML Programming—Tips and Techniques