<?xml version="1.0" encoding="UTF-8"?><!-- MAGEC is a trademark of Al Lee & Associates, Inc. © 2026 Al Lee & Associates, Inc. All rights reserved. All programs, scripts, diagrams, and documentation are copyright protected. -->
<flowchart title="MBP INPUT PROCEDURE">
<settings theme="bold" exportWidth="600" grid="true" logo="ALA_Logo_gray.png"/>
    <nodes>

        <node id="title" type="title" label="MBP INPUT PROCEDURE">
            <position x="280" y="20"/>
            <narrative>MBP INPUT PROCEDURE — logic flow diagram for the standard MAGEC-generated batch report sort input procedure.</narrative>
        </node>

        <node id="subtitle" type="comment" label="Read, Join, Select, Release to Sort">
            <position x="280" y="75"/>
            <narrative>Reads records from the primary file via browse, performs logical joins, applies selection logic with optional bypass, and releases qualified records to the sort/work file. Supports %SELECT logic for filtering and %MYTOSRT for releasing records to the sort process.</narrative>
        </node>

        <node id="1" type="start" label="Begin">
            <position x="100" y="140"/>
            <narrative>Start of INPUT PROCEDURE.</narrative>
        </node>

        <node id="2" type="process" label="PROCEDURE DIVISION   %PREINIT">
            <position x="100" y="240"/>
            <narrative>Earliest developer intercept point in the batch procedure division, fires before working storage is initialized.</narrative>
            <cobolparagraph>PROCEDURE DIVISION</cobolparagraph>
            <link>insert_main.htm#insert001029</link>
            <target>MAIN</target>
        </node>

        <node id="3" type="process" label="AA100-BEGIN   %INITWS">
            <position x="100" y="340"/>
            <narrative>Initialize working storage for the batch input procedure.</narrative>
            <cobolparagraph>AA100-BEGIN</cobolparagraph>
            <link>insert_main.htm#insert001056</link>
            <target>MAIN</target>
        </node>

        <node id="4" type="process" label="BA102-START-BROWSE   %MGLOCKY">
            <position x="100" y="440"/>
            <narrative>Set the starting position key for the browse using the MAGEC I/O lock-key logic.</narrative>
            <cobolparagraph>BA102-START-BROWSE</cobolparagraph>
            <link>insert_main.htm#insert001058</link>
            <target>MAIN</target>
        </node>

        <node id="5" type="process" label="BA102-START-BROWSE   %MGREDLE">
            <position x="100" y="540"/>
            <narrative>Perform the initial read-less-than-or-equal to position the browse at the starting record.</narrative>
            <cobolparagraph>BA102-START-BROWSE</cobolparagraph>
            <link>insert_main.htm#insert001059</link>
            <target>MAIN</target>
        </node>

        <node id="6" type="decision" label="Rec Found?">
            <position x="100" y="650"/>
            <narrative>Tests the result of the initial browse positioning read. NOT FOUND means there is no input data — routes directly to EOF. REC FOUND continues into the main read loop.</narrative>
        </node>
        <node id="6nf" type="elbow" label="">
            <position x="550" y="650"/>
            <narrative> NOT FOUND means there is no input data — routes directly to %EOF. </narrative>
        </node>

        <node id="7" type="process" label="BA110-READ-NEXT   %MGREDNX">
            <position x="100" y="770"/>
            <narrative>Top of the main read loop — reads the next sequential record from the primary file via the MAGEC I/O module.</narrative>
            <cobolparagraph>BA110-READ-NEXT</cobolparagraph>
            <link>insert_main.htm#insert001060</link>
            <target>MAIN</target>
        </node>
        <node id="7bp" type="elbow" label="">
            <position x="1" y="770"/>
            <narrative>reads the next sequential record from the primary file via the MAGEC I/O module.</narrative>
            <cobolparagraph>BA110-READ-NEXT</cobolparagraph>
            <link>insert_main.htm#insert001060</link>
            <target>MAIN</target>
        </node>

        <node id="8" type="process" label="JA100-LOGICAL-JOIN   %JOIN">
            <position x="100" y="870"/>
            <narrative>Perform logical join — read secondary files and/or compute derived fields to build the complete logical record.</narrative>
            <cobolparagraph>JA100-LOGICAL-JOIN</cobolparagraph>
            <link>insert_main.htm#insert001018</link>
            <target>MAIN</target>
        </node>
        <node id="8nf" type="elbow" label="">
            <position x="550" y="870"/>
            <narrative/>
            <cobolparagraph>JA100-LOGICAL-JOIN</cobolparagraph>
            <link>insert_main.htm#insert001018</link>
            <target>MAIN</target>
        </node>

        <node id="9" type="process" label="BA115-SELECT   %SELECT">
            <position x="100" y="970"/>
            <narrative>Apply selection logic to the record just read and joined — determines whether to bypass, end, or process this record.</narrative>
            <cobolparagraph>BA115-SELECT</cobolparagraph>
            <link>insert_main.htm#insert001067</link>
            <target>MAIN</target>
        </node>

        <node id="10" type="decision" label="Release Decision">
            <position x="100" y="1080"/>
            <narrative>Evaluates the result of BA115-SELECT. BYPASS loops back to read the next record without releasing this one. END terminates the read loop and routes to EOF. PROCESS releases the record to the sort/work file via %MYTOSRT.</narrative>
        </node>
        <node id="10bp" type="elbow" label="">
            <position x="1" y="1080"/>
            <narrative>loops back to read the next record without releasing this one.</narrative>
        </node>

        <node id="11" type="process" label="Release to Sort   %MYTOSRT">
            <position x="450" y="1080"/>
            <narrative>Releases the qualified record to the sort/work file. After release, the loop continues back to read the next record.</narrative>
            <cobolparagraph>RELEASE</cobolparagraph>
            <link>insert_main.htm#insert001062</link>
            <target>MAIN</target>
        </node>
        <node id="11a" type="elbow" label="">
            <position x="450" y="770"/>
            <narrative>Releases the qualified record to the sort/work file. After release, the loop continues back to read the next record.</narrative>
            <cobolparagraph>RELEASE</cobolparagraph>
            <link>insert_main.htm#insert001062</link>
            <target>MAIN</target>
        </node>

        <node id="12nf" type="elbow" label="">
            <position x="550" y="1240"/>
            <narrative>End-of-file processing — reached when there is no input data, or when the selection logic indicates the read loop should terminate.</narrative>
            <cobolparagraph>EOF</cobolparagraph>
            <link/>
            <target>MAIN</target>
        </node>
        <node id="12" type="process" label="EOF">
            <position x="100" y="1240"/>
            <narrative>End-of-file processing — reached when there is no input data, or when the selection logic indicates the read loop should terminate. Immediately after EOF, the sort work file will begin sorting the records reoeased to it. Then the Output Procedure will start (see Figure 08).</narrative>
            <cobolparagraph>EOF</cobolparagraph>
            <link>diags_main.htm#diags009000</link>
            <target>MAIN</target>
        </node>

        <node id="99" type="end" label="End">
            <position x="100" y="1340"/>
            <narrative>End of INPUT PROCEDURE.</narrative>
        </node>
        <node id="999" type="comment" label="Figure 07 - MBP Input Procedure">
            <position x="350" y="1380"/>
            <narrative>Figure 07 - MBP Input Procedure</narrative>
        </node>

    </nodes>
    <edges>
        <!-- Main top-to-bottom path -->
        <edge from="1" to="2"/>
        <edge from="2" to="3"/>
        <edge from="3" to="4"/>
        <edge from="4" to="5"/>
        <edge from="5" to="6"/>

        <!-- Initial read decision -->
        <edge from="6" to="6nf" label="❌ Not Found (No Input Data)"/>
        <edge from="6nf" to="12nf"/>
        <edge from="12nf" to="12"/>
        <edge from="6" to="7" label="✅ Rec Found"/>

        <!-- Main read loop -->
        <edge from="7" to="8"/>
        <edge from="8" to="9"/>
        <edge from="8" to="8nf" label="Not Found (EOF)"/>
        <edge from="8nf" to="12nf"/>
        <edge from="9" to="10"/>

        <!-- Release decision -->
        <edge from="10" to="10bp" label=""/>
        <edge from="10bp" to="7bp" label="🔁Bypass (loop)"/>
        <edge from="7bp" to="7" label=""/>
        <edge from="10" to="12" label="End"/>
        <edge from="10" to="11" label="✅ Process"/>

        <!-- Release loops back to read next -->
        <edge from="11" to="11a" label="🔁loop back"/>
        <edge from="11a" to="7" label=""/>

        <!-- Finish -->
        <edge from="12" to="99"/>
    </edges>
</flowchart>