A repeating relationship occurs when the name of a table is repeated as the subject of a relationship. In general, a repeating relationship should be used when the subject of the relationship wanted is not the object of the last relationship specified.
The following FIND statement uses the common key CUST-ID-KEY to connect the CAI-CUST-REC table with the CAI-DETAIL-REC table and the CAI-ORDERS-REC table in a repeating relationship.
FIND 10 CAI-CUST-REC ROWS
RELATED BY CUST-ID-KEY TO
AND CAI-CUST-REC RELATED BY CUST-ID-KEY
TO CAI-ORDERS-REC ROWS
WITH ORD-YR = '87'
The preceding example contains two RELATED BY statements. This repetition indicates that a relationship must exist between more than two tables before a logical row is selected. In the example, the relationship of three tables is established.