General Format
Iterator-ID. Iterator-name-1 [AS literal-1].
Syntax Rules:
- The procedure division header of an Iterator must include a Yielding phrase. The type of the item specified in the Yielding phrase determines the type of the iterators.
General Rules
- For an iterators of type T, the system will automatically generate a nested class which implements both IEnumerable[T] and IEnumerator[T].
- The system also generates a method with the name specified in the Iterator-ID paragraph. This method returns an item of the nested type defined in GR 1.
- Code outside the context of the iterators may invoke this method to return the iteration object, and iterate through it using the PERFORM THROUGH collection class syntax (see PERFORM statement format 5).
- The order in which iteration proceeds is determined by the successive RETURNING values when each EXIT ITERATOR statement is executed.