<?xml version="1.0" encoding="UTF-8"?>

<LogicDiagram id="ch04fig13" source="ch04fig13.jpg">

  <Nodes>

    <Process id="P1" name="%PREINIT"/>
    <Process id="P2" name="%INITWS"/>
    <Process id="P3" name="%MGLOCKY"/>
    <Process id="P4" name="%MGREDLE"/>
    <Process id="P5" name="%MGREDNX"/>
    <Process id="P6" name="%JOIN"/>
    <Process id="P7" name="%SELECT"/>
    <Process id="P8" name="%MVTSORT"/>

    <Decision id="D1" name="EOF / NO MORE DATA?"/>

    <Terminal id="T1" name="GO TO NEXT PAGE"/>
    <Terminal id="T2" name="END OF PROCEDURE"/>

  </Nodes>

  <Edges>

    <!-- Main sequential processing flow -->
    <Edge from="P1" to="P2"/>
    <Edge from="P2" to="P3"/>
    <Edge from="P3" to="P4"/>
    <Edge from="P4" to="P5"/>
    <Edge from="P5" to="P6"/>
    <Edge from="P6" to="P7"/>
    <Edge from="P7" to="P8"/>

    <!-- EOF decision after sort/output stage -->
    <Edge from="P8" to="D1"/>

    <!-- EOF handling -->
    <Edge from="D1" to="T2" condition="YES"/>
    <Edge from="D1" to="T1" condition="NO"/>

    <!-- Loop back behavior implied by diagram -->
    <Edge from="T1" to="P4" condition="NEXT-PAGE-CONTINUATION"/>

  </Edges>

  <Summary>

    <Observation>
      This procedure performs sequential initialization, locking, read,
      join, select, and sort operations before evaluating EOF.
    </Observation>

    <Observation>
      If EOF is reached, processing terminates.
      Otherwise, control returns to next-page processing and continues
      from the read/join stage.
    </Observation>

    <Observation>
      The structure represents a paged input processing loop with
      persistent state across iterations.
    </Observation>

  </Summary>

</LogicDiagram>