Technical data
RETAINING clause, a FETCH NEXT WITHIN PART_SUPPLY would use PART’s
currency and FETCH the first SUPPLY record belonging to PART.
Figure 7–5 Split Screen After FETCH CURRENT PART RETAINING PART_SUPPLY
PART_SUPPLY
%DBM − I − CURDISPLA, Currency for run unit is 1:2:7
PART
maintainedCURRENTLegend: POSITION null
ZK−6072−GE
%DBM − I − CURDISPLA, Currency for PART record type is 1:2:7
%DBM − I − CURDISPLA, Currency for MARKETS realm is 1:2:7
PART_ID = AZ177311
PART_DESC = GASKET
PART_STATUS = G
PART_SUPPORT = RE
SUPPLY
Now you can retest the MODIFY PART_STATUS.
dbq> MODIFY PART_STATUS
PART_STATUS [CHARACTER(1)]= X
dbq>
The DBQ prompt indicates the MODIFY was successful.
With the logic error found and fixed, you can test to see if the next execution of
the FETCH NEXT WITHIN PART_SUPPLY fetches the next SUPPLY record
belonging to the first PART record.
dbq> FETCH NEXT WITHIN PART_SUPPLY
The database keys displayed by the currency update messages in Figure 7–6 and
Figure 7–7 are the same, thereby showing the A100-LOOP paragraph will fetch
the next SUPPLY record owned by the first PART record.
Notice the data items also have the same value. Comparing data item contents
instead of database key values is not a good practice because duplicate records
may be allowed. For example, a PART may have two or more SUPPLY records
containing the same data. Also, each SUPPLY record could point to a different
owner in the VENDOR_SUPPLY set type.
7–8 Debugging and Testing HP COBOL DML Programs