Technical data

Figure 5–28 Currency Status by Executable DML Statement
CASSETTE
2−DAYS
MUSICO INC.
5−DAYS
SOUND−OFF
NULL
2−DAYS
MUSICO INC.
5−DAYS
SOUND−OFF
NULL
NULL
NULL
NULL
NULL
CASSETTE
2−DAYS
2−DAYS
5−DAYS
5−DAYS
CASSETTE
CASSETTE
CASSETTE
CASSETTE
CASSETTE
NULL
2−DAYS
MUSICO INC.
5−DAYS
SOUND−OFF
510
*560
*600
**560
**600
CASSETTE
CASSETTE
CASSETTE
CASSETTE
CASSETTE
NULL
NULL
MUSICO INC.
MUSICO INC.
SOUND−OFF
NULL
2−DAYS
2−DAYS
5−DAYS
5−DAYS
STATEMENT RUN UNIT REALM SET TYPE RECORD
PART_INFO
VENDOR_
SUPPLY
PART VENDOR SUPPLY
MARKET MAKE BUY
* First execution
** Second execution
ZK−1505−GE
5.14.1 Using the RETAINING Clause
You use the RETAINING clause to save a currency indicator you want to refer to.
You use the RETAINING clause to: ( 1 ) navigate through the database and return
to your original starting point, or ( 2 ) walk through a set type. (The expression
‘‘walk through a set type’’ implies a procedure where you access all owner records
and their respective members.) Refer to the Section 4.9.1, Section 5.14.1, and
Section 6.11 for further information.
After finding all members for an owner, the current of run unit is the last
accessed member record occurrence in the set. If the next statement is a FIND
NEXT for an owner, you may not retrieve the next owner. This is because:
Current of set type (in this case, the last member record occurrence) is also
current of run unit.
Without a WITHIN clause, the FIND (or FETCH) is based on current of run
unit.
Because DBCS uses currency status as pointers, a FIND NEXT VENDOR
WITHIN MARKET uses current of MARKET realm to find the next owner record
occurrence. To make sure a FIND (or FETCH) next owner statement finds the
next logical owner record, use the RETAINING clause, as shown in Example 5–4.
5–30 Database Programming with HP COBOL