<?xml version="1.0" encoding="Shift_JIS"?>
<?xml-stylesheet type="text/xsl" href="../Fmethod_xsl/fmethod_he_c.xsl"?>

<root>
  <func>
    <title>cnc_search</title>


    <declare>
      <vc>
        <include>#include "fwlib32.h"</include>
        <prottype>FWLIBAPI short WINAPI cnc_search(unsigned short FlibHndl, short number);</prottype>
        <prottype><br/><br/></prottype>
        <prottype><br/>For the program number 8 digits :<br/><br/>
                  FWLIBAPI short WINAPI cnc_search(unsigned short FlibHndl, long number);
        </prottype>
      </vc>
    </declare>



    <doc>
        <cmn>
            Searches the NC program registered in the program memory of CNC.<br/>
            <li>HSSB</li>
            <ul>
                In case of Series 150/150i, searching is delayed under the following condition.<br/>
                <span class="dd">&#8226;Edit processing on the CNC side (include background edit processing)</span><br/>
                <span class="dd">&#8226;downloading, verifying</span><br/>
                <br/>
                In Series160/180, 160i/180i, 300i, Power Mate i, it is possible to use this function for
                the program number 8 digits, however it is necessary to switch API to the one for the program
                number 8 digits.<br/>
                In Series 150i, it is necessary to switch API to the one for the program number 8 digits.<br/>
                See <a href="general.htm#O8" target="_parent">Program number 8 digits</a> for details.
            </ul>
            <li>Ethernet</li>
            <ul>
                It is possible to use this function for the program number 8 digits,
                however it is necessary to switch API to the one for the program number 8 digits.<br/>
                In series 150i, it is necessary to switch API to the one for the program number 8 digits.<br/>
                See <a href="general.htm#O8" target="_parent">Program number 8 digits</a> for details.
            </ul>
        </cmn>

        <is>
            <p>Searches the NC program registered in the program memory of CNC.</p>
            <p>It is possible to use this function for the program number 8 digits,
            however it is necessary to switch API to the one for the program number 8 digits.
            See <a href="general.htm#O8" target="_parent">Program number 8 digits</a> for details.
            </p>
        </is>
    </doc>



    <argument>
        <common>
            <cmn>
                <item>
                    <name>FlibHndl</name>
                    <type>in</type>
                    <content>
                        <p>
                            Specify the library handle.
                            See "<a href="handle.htm" target="_parent">Library handle</a>" for details.
                        </p>
                    </content>
                </item>
                <item>
                    <name>number</name>
                    <type>in</type>
                    <content>
                        <p>
                            Specify program number.
                        </p>
                    </content>
                </item>
            </cmn>
        </common>

        <is>
            <hssb>
                <vc>
                    <item>
                        <name>FlibHndl</name>
                        <type>in</type>
                        <content>
                            <p>
                                Specify the library handle.
                                See "<a href="handle.htm" target="_parent">Library handle</a>" for details.
                            </p>
                        </content>
                    </item>
                    <item>
                        <name>number</name>
                        <type>in</type>
                        <content>
                            <p>
                                Specify program number.
                            </p>
                        </content>
                    </item>
                </vc>
            </hssb>
        </is>
    </argument>



    <errcode>
        <item>
            <name>EW_FUNC</name>
            <content>
                Unavailable<br/>
                    This application is not customized for the program number 8 digits.<br/>
                    See "<a href="general.htm#O8" target="_parent">Program number 8 digits</a>" for details. 
            </content>
        </item>
        <item>
            <name>EW_BUSY</name>
            <content>
                Busy<br/>
                <br/>
                    <ul style="margin-top:0">
                        <li>&quot;OP&quot; signal(DO) on(only EDIT mode or MEMORY mode)</li>
                            Automatic operation is being executed on CNC.<br/>
                        <br/>
                        <li>Downloading, verifying</li>
                            Terminate a downloading, verifying by using <a href="Program/cnc_dwnend.htm" target="_parent">cnc_dwnend</a>, <a href="Program/cnc_dwnend3.htm" target="_parent">cnc_dwnend3</a>, <a href="Program/cnc_vrfend.htm" target="_parent">cnc_vrfend</a> function.<br/>
                        <br/>
                        <li>Alarm (PS000, PS101) on CNC side (except 150i, 300i)</li>
                            Reset the alarm on CNC.
                        <li>CNC is in the emergency stop. (300i/310i/320i)</li>
                    </ul>
            </content>
        </item>
        <item>
            <name>EW_DATA</name>
            <content>
                Data error<br/>
                Program(number) is not found.
            </content>
        </item>
        <item>
            <name>EW_PROT</name>
            <content>
                Series 160/180/210, 160i/180i/210i, 0i, 300i, Power Mate i<br/>
                Program is protected from editing. <br/>
            </content>
        </item>

        <is>
            <item>
                <name>EW_BUSY</name>
                <content>
                    Busy
                    <ul style="margin-top:0;margin-bottom:0">
                        <li>&quot;OP&quot; signal(DO) on(only EDIT mode or MEMORY mode)</li>
                            Automatic operation is being executed on CNC.
                        <li>Downloading, verifying</li>
                            Terminate a downloading, verifying by using <a href="Program/cnc_dwnend3.htm" target="_parent">cnc_dwnend3</a>, <a href="Program/cnc_vrfend.htm" target="_parent">cnc_vrfend</a> function.
                    </ul>
                </content>
            </item>
            <item>
                <name>EW_DATA</name>
                <content>
                    Data error<br/>
                    Program(number) is not found.
                </content>
            </item>
            <item>
                <name>EW_PROT</name>
                <content>
                    Program is protected from editing. <br/>
                </content>
            </item>
        </is>
    </errcode>



    <option>
        <hssb>The extended driver/library function is necessary.</hssb>
        <ethr><p>The Ethernet function and the extended driver/library function are necessary.</p>
              <p>However, in case of Series 160i/180i/210i/0i MODEL B and 300i, the required CNC option is as follows.</p>
              <p>When Embedded Ethernet is used,</p>
              <p><ul>above two optional functions are not required.</ul></p>
              <p>When Ethernet board is used,</p>
              <p><ul>only Ethernet function is required.</ul></p>
        </ethr>
    </option>



    <parameter>
        <type>
            <ul>
                <li>Series 160/180/210, 160i/180i/210i, 0i, 300i</li>
                    3202#0,#4,#6 (influenced by setting)<br/>
                    3204#3,#4 (influenced by setting)<br/>
                    3210,3211 (influenced by setting)<br/>
                <br/>
                <li>Power Mate i</li>
                    3202#0,#4,#6 (influenced by setting)<br/>
                    3204#3,#4 (influenced by setting)<br/>
            </ul>
        </type>
    </parameter>

    <is_parameter>
        <type>
            <ul>
                3202#0,#4,#6<br/>
                3204#3,#4<br/>
                3210,3211
            </ul>
        </type>
    </is_parameter>



    <mode>
        <cmn>
            <ul>
            <li>HSSB</li>
            <ul>
                <li>Series 150</li>
                    <table class="dd">
                        <tr><td>EDIT mode</td><td>:</td><td>foreground search</td></tr>
                        <tr><td>Other mode</td><td>:</td><td>background search</td></tr>
                    </table>
                <li>Series 150i, 160/180/210, 160i/180i/210i, 0i, 300i, Power Mate i</li>
                    <table class="dd">
                        <tr><td>EDIT,MEM mode</td><td>:</td><td>foreground search</td></tr>
                        <tr><td>Other mode</td><td>:</td><td>background search</td></tr>
                    </table>
            </ul>
            <br/>
            <li>Ethernet</li>
            <ul>
                <li>The behavior of this function depends on the CNC mode. </li>
                    <table class="dd">
                        <tr><td>EDIT, MEM mode</td><td>:</td><td>foreground search</td></tr>
                        <tr><td>Other mode</td><td>:</td><td>background search</td></tr>
                    </table>
            </ul>
            </ul>
        </cmn>
    </mode>

    <is_mode>
        <cmn>
            <p>The behavior of this function depends on the CNC mode. </p>
            <table class="dd">
                <tr><td>EDIT, MEM mode</td><td>:</td><td>foreground search</td></tr>
                <tr><td>Other mode</td><td>:</td><td>background search</td></tr>
            </table>
            <p>
            (foreground search : set again selecting program.)<br/>
            (background search : check whether the specified program exists or not.) 
            </p>
        </cmn>
    </is_mode>



    <support>
        <m>
            <fs0ia>H</fs0ia>
            <fs0ib>O</fs0ib>
            <fs15>H</fs15>
            <fs15i>O</fs15i>
            <fs16>H</fs16>
            <fs18>H</fs18>
            <fs21>H</fs21>
            <fs16ia>O</fs16ia>
            <fs18ia>O</fs18ia>
            <fs21ia>O</fs21ia>
            <fs16ib>O</fs16ib>
            <fs18ib>O</fs18ib>
            <fs21ib>O</fs21ib>
            <fs30i>O</fs30i>
        </m>
        <t>
            <fs0ia>H</fs0ia>
            <fs0ib>O</fs0ib>
            <fs15>H</fs15>
            <fs15i>X</fs15i>
            <fs16>H</fs16>
            <fs18>H</fs18>
            <fs21>H</fs21>
            <fs16ia>O</fs16ia>
            <fs18ia>O</fs18ia>
            <fs21ia>O</fs21ia>
            <fs16ib>O</fs16ib>
            <fs18ib>O</fs18ib>
            <fs21ib>O</fs21ib>
            <fs30i>O</fs30i>
        </t>
        <lc>
            <fs0ia>X</fs0ia>
            <fs0ib>X</fs0ib>
            <fs15>X</fs15>
            <fs15i>X</fs15i>
            <fs16>H</fs16>
            <fs18>H</fs18>
            <fs21>H</fs21>
            <fs16ia>H</fs16ia>
            <fs18ia>H</fs18ia>
            <fs21ia>H</fs21ia>
            <fs16ib>H</fs16ib>
            <fs18ib>H</fs18ib>
            <fs21ib>H</fs21ib>
            <fs30i>X</fs30i>
        </lc>
        <p>
            <fs16i>O</fs16i>
            <fs18i>O</fs18i>
        </p>
        <l>
            <fs16i>O</fs16i>
            <fs18i>X</fs18i>
        </l>
        <w>
            <fs16i>O</fs16i>
            <fs18i>O</fs18i>
        </w>
        <pw>
            <d>O</d>
            <h>O</h>
        </pw>
        
        <is>
            <m>
                <fs30is>O</fs30is>
            </m>
            <t>
                <fs30is>O</fs30is>
            </t>
        </is>
    </support>



    <example>
<vc>
The following program searches the program whose program number is same as
specified one, and displays the result.

#include "fwlib32.h"

/* num is program number to be searched. */
void example( short num )
{
    short ret ;
    ret = cnc_search( h, num ) ;
    switch ( ret ) {
        case EW_OK:
            printf( "PROGRAM O%d has been searched.\n", num ) ;
            break;
        case EW_DATA:
            printf( "PROGRAM O%d doesn't exist.\n", num ) ;
            break;
        case EW_PROT:
            printf( "PROTECTED.\n" ) ;
            break;
        case EW_BUSY:
            printf( "REJECTED.\n" ) ;
            break;
    }
}
</vc>
    </example>



  </func>
</root>
