next up previous contents
Next: Some Language Details for Up: Tasks involving Record Iteration Previous: Loop over All Banks

Double Loop over Unique Bank Pairs in a Record

In this example, the programmer wishes to consider all unique pairs of CMUO banks found in a record. The outer loop is the same as in the previous example. The inner loop differs though. The inner loop's initialization clause uses the value corresponding to an record iterator pointing to the CMUO bank after the CMUO bank pointed to by my_iter1 to initialize my_iter2.

for (TRY_Record_Iter_Same my_iter1(p_record,"CMUO") ;
                          my_iter1.is_valid() ; ++my_iter1)
  {
    for (TRY_Record_Iter_Same my_iter2(my_iter1.copy_next()) ;
                              my_iter2.is_valid() ; ++my_iter2)
      {
        // my_iter1 points to each CMUO Bank in Record sequentially
        // my_iter2 is initialized to the CMUO Bank after my_iter1 (if any)
        // (my_iter1, my_iter2) cover all unique CMUO bank pairs in Record
      }
  }





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