Download CDML 2.2 Technical data

Transcript
The following example locates all PART records with a PART_STATUS of J and
puts their dbkey values in keeplist TWO.
FIND ALL TWO PART USING PART_STATUS
PART_STATUS X(l) = J
6.13 FIND NEXT and FETCH NEXT Loops
If you have a FIND NEXT or FETCH NEXT loop in your program, the first
execution of the loop is the same as executing a FIND FIRST or FETCH FIRST.
Unless you properly initialize them, currency indicators can affect selection of
the specified record. For example, if ITEM B in Figure 6–10 is current for INV_
ITEMS, a FIND NEXT INV_ITEMS makes ITEM C the current record for the
run unit. You can null a currency by executing a FREE CURRENT statement.
Figure 6–10 Using FIND NEXT and FETCH NEXT Loops
WHSE A
ACME SUPPLY
WAREHOUSE_SET
(INV_ITEMS)
ITEM A
SUPPLIER_SET
ITEM B
ITEM C
ITEM D
ITEM E
ZK−1518−GE
Example 6–5 makes the INV_ITEMS currency null prior to executing a FETCH
NEXT loop.
Example 6–5 FETCH NEXT Loop
.
.
.
000100 GET-WAREHOUSE.
000110
MOVE "A" TO WHSE-ID.
000120
FIND FIRST WHSE_REC USING WHSE-ID.
000130 UPDATE-ITEM.
000140
MOVE "B" TO ITEM-ID.
000150
FETCH FIRST WITHIN WAREHOUSE_SET
000160
USING ITEM-ID.
****************************
* INVENTORY UPDATE ROUTINE *
****************************
.
.
.
*****************************************************
* The next statement nulls the run unit currency. *
* Therefore, the first execution of the FETCH NEXT *
* gets the first INV_ITEMS record.
*
*****************************************************
(continued on next page)
DML Programming—Tips and Techniques 6–15