next up previous contents
Next: Double Loop over Unique Up: Tasks involving Record Iteration Previous: Loop over All Banks

Loop over All Banks with Same Name in a Record

In this example, the programmer wishes to loop through all CMUO banks in a record, one at a time. The initialization clause assures that the iterator points to the first CMUO bank in the record. The end test clause checks that the iterator is still valid (not at end of record). If there are no CMUO Banks in the record, this loop will not execute at all, as desired. Finally the iteration clause causes the iterator to point to the next CMUO bank. The CMUO banks are visited in the same order in which they happen to be arranged in the record. There is no guarantee that the bank numbers, for instance, will be in increasing or decreasing order.

for (TRY_Record_Iter_Same my_iter(p_record,"CMUO") ;
                          my_iter.is_valid() ; ++my_iter)
  {
    // my_iter points to each CMUO bank in record sequentially
  }



Robert Kennedy
Mon Jul 28 13:23:28 CDT 1997