Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ isstart(S) — OpenDesktop Software Development System 3.0.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

isread(S)


 isstart(S)                     6 January 1993                     isstart(S)


 Name

    isstart - select an index and locate a record

 Syntax


    cc  . . .  -lisam


    isstart (isfd, keydesc, length, record, mode)
    int isfd;
    struct keydesc *keydesc;
    int length;
    char *record;
    int mode;


 Description

    The isstart function selects an index for subsequent use.  It also
    locates, but does not read, a record based on the selected index.  Use
    the isread function to read this and subsequent records using this index.

    You can use the following arguments with this routine:

    _________________________________________________________________________
    Argument                         Description
    _________________________________________________________________________
    isfd                             File descriptor identifying the ISAM
                                     file that has the index to be selected.
    keydesc                          Structure describing the index to be
                                     selected.  The index must already exist.
    length                           Number of bytes of the index key to use
                                     during the search for the record.  Zero
                                     indicates that the whole key is to be
                                     used.
    record                           Character buffer holding the key value
                                     to be used in locating the record if
                                     mode is one of ISEQUAL, ISGREAT, or
                                     ISGTEQ.
    mode                             Integer that determines the logic for
                                     searching the index for the desired
                                     record.  The allowed values are
                                     described below.

    If the mode is set to ISEQUAL, ISGREAT, or ISGTEQ, then prior to calling
    the function a key value is placed in the record buffer.  The value's
    position in the record buffer must match the position specified in key-
    desc. The length parameter determines how many bytes of the key are used
    in the search.

    The mode parameter tells isstart how to find the desired record. The
    allowed modes as defined in isam.h are:

    _________________________________________________________________________
    Start Mode    Description
    _________________________________________________________________________
    ISFIRST       first record
    ISLAST        last record
    ISEQUAL       first exact match of search value
    ISGREAT       first record greater than search value
    ISGTEQ        first record greater than or equal to search value

    If the desired record is known to be the first or last in the current
    ordering, then use the ISFIRST or ISLAST mode value.  In these cases, the
    record and length parameters are not used.

    If ISFIRST is used, then the pointer is positioned just before the first
    record in the selected index order.  You should then call the isread
    function using the ISNEXT mode parameter to read the first record in the
    selected order.

    If ISLAST is used, then the pointer is positioned just after the last
    record in the selected index order.  You should then call the isread
    function using the ISPREV mode parameter to read the last record in the
    selected order.

    If the position of the desired record is not first or last, then use one
    of the ISEQUAL, ISGREAT, or ISGTEQ mode values (and a key value in
    record) to locate the desired record.

    If ISEQUAL is used, the function locates the first record with a key
    value matching the record parameter.

    If ISGREAT is used, the function locates the first record whose key value
    is greater than the key field in the record parameter.

    If ISGTEQ is used, the function locates the first record whose key value
    is greater than or equal to the key field in the record parameter.

    A special case of isstart can be used to access a file in physical order.
    To do this, set the value of the knparts member of keydesc to zero.
    isstart ignores all indexes and position on the first physical record.
    See isread(S) for more information.

    If a match is found, then the current record position pointer and isrec-
    num are set to this record.  If no match is found, then iserrno is set to
    ENOREC and a -1 error code is returned.

 Example

    This example makes titlekey the current index, uses the entire key, and
    locates a record matching the search value in the buffer:

       isstart( bookfd, titlekey, 0, buffer, ISEQUAL ) ;


 See also

    isread(S)

 Standards conformance

    isstart is not part of any currently supported standard; it is an exten-
    sion of AT&T System V provided by the Santa Cruz Operation.


Typewritten Software • bear@typewritten.org • Edmonds, WA 98026