<?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="LOC / SCN / FND Function">
<settings theme="bold" exportWidth="600" grid="true" logo="ALA_Logo_gray.png"/>
    <nodes>

        <node id="title" type="title" label="LOC / SCN / FND Function">
            <position x="300" y="20"/>
            <narrative>LOC / SCN / FND Function — Browse and selection logic with continuation and new transaction modes.</narrative>
        </node>
    

        <node id="subtitle" type="comment" label="Browse / Selection — Continuation and New Transaction Modes">
            <position x="300" y="75"/>
            <narrative>The %SELECT insertion point sets a flag to process, bypass, or simulate EOF for each item read for any LOC, SCN, or FND function. The SCN and FND functions also perform further selection matching afterwards.</narrative>
        </node>

        <node id="1" type="start" label="Begin">
            <position x="95" y="140"/>
            <narrative>Entry into the LOC / SCN / FND Function.</narrative>
        </node>

        <node id="2" type="process" label="AA100-CHECK-FUNCTION %PREINIT">
            <position x="95" y="240"/>
            <narrative>Check function code and perform pre-initialization processing. Earliest developer intercept point — runs for every transaction and every function.</narrative>
            <cobolparagraph>AA100-CHECK-FUNCTION</cobolparagraph>
            <link>insert_main.htm#insert001029</link><target>MAIN</target>
        </node>
        <node id="2asides" type="aside" label=" Narrative of Steps - -SCN">
            <position x="450" y="200"/>
            <narrative>Narrative for function.</narrative>
            <link>https://www.magec.com/DOC/genmmp_main.htm#genmmp002017</link>
            <target>MAIN</target>
        </node>
        <node id="2asidef" type="aside" label=" Narrative of Steps - -FND">
            <position x="450" y="280"/>
            <narrative>Narrative for function.</narrative>
            <link>https://www.magec.com/DOC/genmmp_main.htm#genmmp002019</link>
            <target>MAIN</target>
        </node>
        <node id="2asidel" type="aside" label=" Narrative of Steps - -LOC">
            <position x="350" y="240"/>
            <narrative>Narrative for function.</narrative>
            <link>https://www.magec.com/DOC/genmmp_main.htm#genmmp002015</link>
            <target>MAIN</target>
        </node>

        <edge from="2" to="2asidel" style="dotted" label="see also"/>
        <edge from="2" to="2asides" style="dotted" label=""/>
        <edge from="2" to="2asidef" style="dotted" label=""/>

        <node id="3" type="process" label="BA100-INIT-STORAGE %LOCINIT">
            <position x="95" y="340"/>
            <narrative>Initialize working storage areas for browse/locate processing.</narrative>
            <cobolparagraph>BA100-INIT-STORAGE</cobolparagraph>
            <link>insert_main.htm#insert001020</link><target>MAIN</target>
        </node>
        <node id="3aside" type="aside" label="Browse Mainline">
            <position x="350" y="340"/>
            <narrative>Mainline logic for all browse functions.</narrative>
            <link>https://www.magec.com/DOC/genmmp_main.htm#genmmp004051</link>
            <target>MAIN</target>
        </node>

        <edge from="3" to="3aside" style="dotted" label="see also"/>

        <node id="4" type="process" label="AAL200-BROWSE-MAINLINE %PFKEYL">
            <position x="95" y="440"/>
            <narrative>Browse mainline processing; handles PF key detection. Tests for cursor selection, continuation mode, new transaction mode, and blank key.</narrative>
            <cobolparagraph>AAL200-BROWSE-MAINLINE</cobolparagraph>
            <link>insert_main.htm#insert001027</link><target>MAIN</target>
        </node>
        <node id="4aside" type="aside" label="TWA-MSK-AREA">
            <position x="350" y="440"/>
            <narrative>First 10-bytes of Mask Area give Mask ID, Cursor position, Entry key detection (ENTER, CLEAR, PF1, PA1, etc.).</narrative>
            <cobolparagraph>TWA-MSK-AREA</cobolparagraph>
            <link>https://www.magec.com/DOC/genmmp_main.htm#genmmp004025</link>
            <target>MAIN</target>
        </node>
        <edge from="4" to="4aside" style="dotted" label="see also"/>
        
        <node id="5" type="decision" label="Cursor Selection Attempted?">
            <position x="95" y="560"/>
            <cobolparagraph>AAL200-BROWSE-MAINLINE</cobolparagraph>
            <narrative>Tests whether the operator positioned the cursor on a valid record and pressed Enter to select it. If yes, bypasses the full browse read loop.</narrative>
            <link>genmmp_main.htm#genmmp004025</link><target>MAIN</target>
        </node>

        <node id="sel" type="decision" label="Valid Cursor Position">
            <position x="350" y="560"/>
            <narrative>route directly to AA900-GOBACK to FTH-FUNCT to SEE/CHG for the selected record.</narrative>
            <link>genmmp_main.htm#genmmp004025</link><target>MAIN</target>
        </node>
        <node id="selx" type="elbow" label="">
            <position x="350" y="680"/>
            <narrative>route directly to AA800-SEND-SCREEN.</narrative>
        </node>
        <node id="selz" type="elbow" label="">
            <position x="350" y="1960"/>
            <narrative>route directly to AA800-SEND-SCREEN.</narrative>
        </node>
        <node id="sel1" type="elbow" label="">
            <position x="580" y="560"/>
            <narrative>route directly to AA900-GOBACK to FTH-FUNCT to SEE/CHG for the selected record.</narrative>
        </node>
        <node id="sel2" type="elbow" label="">
            <position x="580" y="2060"/>
            <narrative>route directly to AA900-GOBACK to FTH-FUNCT to SEE/CHG for the selected record.</narrative>
        </node>

        <node id="6" type="decision" label="Mode?">
            <position x="95" y="680"/>
            <narrative>Determines the processing mode: Continuation Mode (operator paged or scrolled), New Transaction Mode (fresh entry), or Test Key = Space (blank key entered). All three routes converge at BA300-NORMALIZE-KEY.</narrative>
            <link>insert_main.htm#insert001025</link><target>MAIN</target>
        </node>

        <node id="6g" type="elbow" label="">
            <position x="0" y="680"/>
            <narrative>Determines the processing mode: Continuation Mode (operator paged or scrolled), New Transaction Mode (fresh entry), or Test Key = Space (blank key entered). All three routes converge at BA300-NORMALIZE-KEY.</narrative>
            <link>insert_main.htm#insert001025</link><target>MAIN</target>
        </node>

        <node id="7" type="process" label="BA300-NORMALIZE-KEY %NKLOC">
            <position x="95" y="800"/>
            <narrative>Normalize the browse key entered by the operator — reformat and validate it for use as the starting position key.</narrative>
            <cobolparagraph>BA300-NORMALIZE-KEY</cobolparagraph>
            <link>insert_main.htm#insert001025</link><target>MAIN</target>
        </node>

        <node id="8" type="decision" label="Key Error?">
            <position x="95" y="910"/>
            <narrative>Tests whether a key error was detected during normalization. If a key error is found, bypass all file reading and route directly to SEND-SCREEN.</narrative>
            <link>insert_main.htm#insert001025</link><target>MAIN</target>
        </node>

        <node id="errk" type="elbow" label="">
            <position x="350" y="910"/>
            <narrative>Tests whether a key error was detected during normalization. If a key error is found, bypass all file reading and route directly to SEND-SCREEN.</narrative>
            <link>insert_main.htm#insert001025</link><target>MAIN</target>
        </node>

        <node id="9" type="process" label="AAL410-SET-STARTING-POSITION %LOCKY" width="200">
  <position x="180" y="1030"/>
  <narrative>Set the file starting position for the browse read loop using the normalized key.</narrative>
  <link>insert_main.htm#insert001021</link>
  <target>MAIN</target>
  <cobolparagraph>AAL410-SET-STARTING-POSITION</cobolparagraph>
</node>

        <node id="loop1" type="elbow" label="">
            <position x="0" y="1130"/>
            <narrative>Read the next sequential record from the file. This is the top of the browse read loop — control returns here from %SELECT (bypass/reject) and from CA800 (not EOF and screen not full).</narrative>
            <cobolparagraph>AAL430-READ-NEXT-RECORD</cobolparagraph>
            <link>insert_main.htm#insert001033</link><target>MAIN</target>
        </node>

        <node id="10" type="process" label="AAL430-READ-NEXT-RECORD %REDNX" width="200">
  <position x="180" y="1130"/>
  <narrative>Read the next sequential record from the file. This is the top of the browse read loop — control returns here from %SELECT (bypass/reject) and from CA800 (not EOF and screen not full).</narrative>
  <link>insert_main.htm#insert001033</link>
  <target>MAIN</target>
  <cobolparagraph>AAL430-READ-NEXT-RECORD</cobolparagraph>
</node>

        <node id="11" type="process" label="JA100-LOGICAL-JOIN %JOIN">
  <position x="120" y="1230"/>
  <narrative>Perform logical join — secondary files or derived fields joined to the primary record. EOF or NOT FOUND at this point routes to SEND-SCREEN.</narrative>
  <link>insert_main.htm#insert001018</link>
  <target>MAIN</target>
  <cobolparagraph>JA100-LOGICAL-JOIN</cobolparagraph>
</node>

        <node id="12" type="decision" label="EOF / Not Found?">
  <position x="120" y="1340"/>
  <narrative>Tests whether end-of-file or record-not-found was indicated by the join. If either condition is true, the browse list is complete — route to SEND-SCREEN.</narrative>
  
  
  
</node>
        <node id="12nf" type="elbow" label="">
            <position x="350" y="1340"/>
            <narrative>route to SEND-SCREEN.</narrative>
        </node>

        <node id="13" type="process" label="CA700-MOVE-TO-WORK-AREA %SELECT" width="200">
  <position x="120" y="1460"/>
  <narrative>Move data to work area and apply selection logic. %SELECT sets a flag: PROCESS (include this record), BYPASS (skip — loop back to read next), or REJECT (skip — loop back to read next). SCN and FND functions apply additional matching here.</narrative>
  <link>insert_main.htm#insert001067</link>
  <target>MAIN</target>
  <cobolparagraph>CA700-MOVE-TO-WORK-AREA</cobolparagraph>
</node>

        <node id="13lm" type="process" label="CA700-MOVE-TO-WORK-AREA %LOCMOV" width="200">
  <position x="120" y="1550"/>
  <narrative>Build the display line for this record .</narrative>
  <link>insert_main.htm#insert001023</link>
  <target>MAIN</target>
  <cobolparagraph>CA700-MOVE-TO-WORK-AREA</cobolparagraph>
</node>
        <node id="14" type="decision" label="Select Result?">
  <position x="120" y="1640"/>
  <narrative>Evaluates the %SELECT flag. BYPASS or REJECT loop back to read the next record. PROCESS (no bypass) continues to build the screen key entry.</narrative>
  
  
  
</node>
        <node id="14g" type="elbow" label="">
            <position x="0" y="1640"/>
            <narrative>Evaluates the %SELECT flag. BYPASS or REJECT loop back to read the next record. PROCESS (no bypass) continues to build the screen key entry.</narrative>
        </node>

        <node id="15" type="process" label="CA800-BUILD-SKEY %SKEYBLD">
  <position x="120" y="1730"/>
  <narrative>Build the screen key entry for this record and add it to the browse list to be used if operator cursor-selects this record. After building, tests whether the screen is full or EOF was reached.</narrative>
  <link>insert_main.htm#insert001038</link>
  <target>MAIN</target>
  <cobolparagraph>CA800-BUILD-SKEY</cobolparagraph>
</node>
        <node id="15aside" type="aside" label="Short Lists">
            <position x="480" y="1730"/>
            <narrative>Up to 16 keys of items found/listed are saved for a 'Short List' that the operator can display by hitting PF24. Cursor selecting from that list fetches the full-screen SEE Function for the selected item.</narrative>
            <cobolparagraph>Short Lists</cobolparagraph>
            <link>https://www.magec.com/DOC/user_main.htm#user022000</link>
            <target>MAIN</target>
        </node>
        <edge from="15" to="15aside" style="dotted" label="see also"/>


        

        <node id="16" type="decision" label="Screen Full or EOF?">
  <position x="120" y="1820"/>
  <narrative>Determines next action after building a screen entry. If screen is full or EOF, the list is ready — route to SEND-SCREEN. If neither, loop back to read the next record.</narrative>
  
  
  
</node>
        <node id="16g" type="elbow" label="">
  <position x="0" y="1820"/>
  <narrative>Determines next action after building a screen entry. If screen is full or EOF, the list is ready — route to SEND-SCREEN. If neither, loop back to read the next record.</narrative>
  
  
  
</node>

        <node id="17" type="process" label="AA800-SEND-SCREEN %SNDSCRN">
  <position x="120" y="1960"/>
  <narrative>Send the resulting browse screen back to the operator. All paths converge here: cursor selection, key error, EOF/not-found, screen full, and EOF after SKEYBLD.</narrative>
  <link>insert_main.htm#insert001039</link>
  <target>MAIN</target>
  <cobolparagraph>AA800-SEND-SCREEN</cobolparagraph>
</node>

        <node id="18" type="process" label="AA900-GOBACK %GOBACK">
  <position x="120" y="2060"/>
  <narrative>Return control to the caller (GOBACK). Absolutely the last point in the logical flow.</narrative>
  <link>insert_main.htm#insert001012</link>
  <target>MAIN</target>
  <cobolparagraph>AA900-GOBACK</cobolparagraph>
</node>

        <node id="99" type="end" label="End">
  <position x="120" y="2160"/>
  <narrative>LOC / SCN / FND Function processing complete.</narrative>
  
  
  
</node>
        <node id="999" type="comment" label="Figure 02 - LOC/SCN/FND">
            <position x="350" y="2200"/>
            <narrative>Figure 02 - LOC / SCN / FND Function </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"/>
        
        <!-- Loop  path -->
        <edge from="loop1" to="10"/>

        <!-- Cursor selection branch -->
        <edge from="5" to="sel" label="✅ Yes"/>
        <edge from="5" to="6" label="No"/>
        <edge from="sel" to="sel1" label="✅ Valid Selection"/>
        <edge from="sel1" to="sel2" label="✅ Valid Selection"/>
        <edge from="sel2" to="18"/>
        <edge from="sel" to="selx" label="❌ Cursor Badly Positioned"/>
        <edge from="selx" to="selz" label=""/>
        <edge from="selz" to="17" label=""/>

        <!-- Mode decision — all three routes go to BA300 -->
        <edge from="6" to="6g" label="Continuation "/>
        <edge from="6" to="7" label="New Transaction"/>

        <!-- Key normalize -->
        <edge from="7" to="8"/>
        <edge from="8" to="errk" label="❌ Key Error"/>
        <edge from="errk" to="selz"/>
        <edge from="6" to="selx" label="❌ Key Blank"/>
        <edge from="8" to="9" label="✅ Key OK"/>

        <!-- Set position and enter read loop -->
        <edge from="9" to="10"/>

        <!-- Read loop top -->
        <edge from="10" to="11"/>
        <edge from="11" to="12"/>

        <!-- EOF / Not Found -->
        <!-- EOF / Not Found -->
        <edge from="12" to="12nf" label="❌ EOF / Not Found"/>
        <edge from="12nf" to="selz" label=""/>
        <edge from="12" to="13" label="✅ Record Read"/>

        <!-- Select decision -->
        <edge from="13" to="13lm"/>
        <edge from="13lm" to="14"/>
        <edge from="14" to="14g" label="Bypass"/>
        <edge from="14" to="15" label="✅ Process"/>
        <edge from="14g" to="loop1"/>
        
        <edge from="6" to="6g" label="Continuation"/>
        <edge from="6g" to="loop1"/>

        <!-- Build SKEY -->
        <edge from="15" to="16"/>
        <edge from="16" to="16g" label="No"/>
        <edge from="16g" to="loop1" label=""/>
        <edge from="16" to="17" label="Screen Full or EOF"/>

        <!-- Converge and finish -->
        <edge from="17" to="18"/>
        <edge from="18" to="99"/>
    </edges>
</flowchart>