Technical data

Example 5–3 Currency Indicators
000100 PROCEDURE DIVISION
.
.
.
000490 100-FETCH-THE-PART.
000500 MOVE "TAPE" TO PART_DESC.
000510 FETCH FIRST PART USING PART_DESC.
000520 MOVE "A" TO SUP_RATING.
000550 200-FIND-SUPPLY.
000560 FIND NEXT SUPPLY WITHIN PART_INFO
000570 USING SUP_RATING.
000580 AT END
000590 GO TO 500-NO-MORE-SUPPLY.
000600 FETCH OWNER WITHIN VENDOR_SUPPLY.
000610 ************************
000620 * VENDOR PRINT ROUTINE *
000630 ************************
000640 GO TO 200-FIND-SUPPLY.
Statement 000500 provides the search argument used by statement 000510.
Statement 000510 fetches the first occurrence of PART with a PART_DESC equal
to TAPE. Statement 000520 provides the search argument used by statement
000560. Statement 000560 finds each member record occurrence of SUPPLY with
a SUP_RATING equal to A owned by the PART with a PART_DESC equal to
TAPE.
If, instead of its present structure, statement 000560 read ‘‘FIND NEXT SUPPLY
USING SUP_RATING,’’ the search for supply records would not be restricted
to supply member records in the PART_INFO set owned by TAPE. Instead, the
search would extend to all supply records, finding all vendors with a supply
rating equal to A, who may or may not be suppliers of TAPE.
Database Programming with HP COBOL 5–29