/*
 * $Id: rddmisc.txt 9312 2008-09-05 00:08:34Z vszakats $
 */

/*
 * The following parts are Copyright of the individual authors.
 * www - http://www.harbour-project.org
 *
 * Copyright 1999 Luiz Rafael Culik <culik@sl.conex.net>
 *    DB*() documentation
 *    ORD*() documentation
 *    RDD*() documentation
 *
 * See doc/license.txt for licensing terms.
 *
 */

/*  $DOC$
 *  $FUNCNAME$
 *     AFIELDS()*
 *  $CATEGORY$
 *      Database
 *  $ONELINER$
 *      Fills referenced arrays with database field information
 *  $SYNTAX$
 *      AFields(<aNames>[,<aTypes>][,<aLen>][,<aDecs>]) --> <nFields>
 *  $ARGUMENTS$
 *      <aNames>  Array of field names
 *
 *      <aTypes>  Array of field names
 *
 *      <aLens>  Array of field names
 *
 *      <aDecs>  Array of field names
 *  $RETURNS$
 *      <nFields> Number od fields in a database or work area
 *  $DESCRIPTION$
 *      This function will fill a series of arrays with field
 *      names, field types, field lenghts, and number of field
 *      decimal positions for the currently selected or designed
 *      database. Each array parallels the different descriptors
 *      of a file's structure. The first array will consist of the
 *      names of the fields in the current work area. All other arrays
 *      are optional and will be filled with the corrensponding data.
 *      This function will return zero if no parameters are specified
 *      or if no database is avaliable in the current work area. Otherwise,
 *      the number of fields or the lenght of the shortest array argument,
 *      witchever is smaller, will be returned.
 *
 *      AFIELDS() is a compatibility function, it is superseded by
 *      DBSTRUCT() which returns one multidimensional array.
 *
 *      NOTE: The destination arrays must be initialized to a given size,
 *            usually FCOUNT(), before calling this function.
 *
 *  $EXAMPLES$
 *      FUNCTION Main()
 *         LOCAL aNames, aTypes, aLens, aDecs, nCount, nFields, i
 *         USE Test
 *
 *         nCount := FCount()
 *         ? "Number of fields:", nCount
 *         PrintFields( nCount )   // Information for all fields
 *         PrintFields( 4      )   // Information for first 4 fields
 *      RETURN NIL
 *
 *      FUNCTION PrintFields( nCount )
 *         LOCAL aNames, aTypes, aLens, aDecs, nFields, i
 *
 *         aNames  := Array( nCount )
 *         aTypes  := Array( nCount )
 *         aLens   := Array( nCount )
 *         aDecs   := Array( nCount )
 *         nFields := aFields( aNames, aTypes, aLens, aDecs )
 *
 *         ? "Number of items :", nFields
 *         FOR i := 1 TO nFields
 *             ?  i, PadR( aNames[ i ], 12 ), aTypes[ i ]
 *             ?? aLens[ i ], aDecs[ i ]
 *         NEXT
 *         ?
 *      RETURN NIL
 *  $STATUS$
 *      R
 *  $COMPLIANCE$
 *      AFIELDS() is fully CA-Cl*pper compliant.
 *  $FILES$
 *      Library is rdd
 *  $SEEALSO$
 *      DBSTRUCT()
 *  $END$
 */

/*  $DOC$
 *  $FUNCNAME$
 *     ALIAS()
 *  $CATEGORY$
 *      Database
 *  $ONELINER$
 *      Returns the alias name of a work area
 *  $SYNTAX$
 *      Alias([<nWorkArea>]) --> <cWorkArea>
 *  $ARGUMENTS$
 *      <nWorkArea> Number of a work area
 *  $RETURNS$
 *      <cWorkArea> Name of alias
 *  $DESCRIPTION$
 *      This function returns the alias of the work area indicated by <nWorkArea>
 *      If <nWorkArea> is not provided, the alias of the current work area is
 *      returned.
 *  $EXAMPLES$
 *      FUNCTION Main()
 *
 *      USE Test
 *      select 0
 *      qOut( IF(Alias()=="","No Name",Alias()))
 *      Test->(qOut(Alias())
 *      qOut(Alias(1))
 *
 *      RETURN NIL
 *  $STATUS$
 *      R
 *  $COMPLIANCE$
 *      ALIAS() is fully CA-Cl*pper compliant.
 *  $FILES$
 *      Library is rdd
 *  $SEEALSO$
 *      DBF()
 *  $END$
 */

/*  $DOC$
 *  $FUNCNAME$
 *     BOF()
 *  $CATEGORY$
 *      Database
 *  $ONELINER$
 *      Test for the beggining-of-file condition
 *  $SYNTAX$
 *      BOF() --> <lBegin>
 *  $RETURNS$
 *      BOF() Logical true (.T.) or false (.F.)
 *  $DESCRIPTION$
 *      This function determines if the beggining of the file marker has been
 *      reached. If so, the function will return a logical true (.T.); otherwise,
 *      a logical false (.F.) will be returned.
 *      By default, BOF() will apply to the currently selected database unless
 *      the function is preceded by an alias
 *  $EXAMPLES$
 *      FUNCTION Main()
 *        USE Tests NEW
 *        DBGOTOP()
 *        ? "Is Eof()",EOF()
 *        DBGOBOTTOM()
 *        ? "Is Eof()",EOF()
 *        USE
 *     RETURN NIL
 *  $STATUS$
 *      R
 *  $COMPLIANCE$
 *      BOF() is fully CA-Cl*pper compliant.
 *  $FILES$
 *      Library is rdd
 *  $SEEALSO$
 *    EOF(),FOUND(),LASTREC()
 *  $END$
 */

/*  $DOC$
 *  $COMMANDNAME$
 *      ZAP
 *  $CATEGORY$
 *      Command
 *  $ONELINER$
 *      Remove all records from the current database file
 *  $SYNTAX$
 *      ZAP
 *  $DESCRIPTION$
 *      This command removes all of the records from the database in the
 *      current work area. This operation also updates any index file in
 *      use at the time of this operation. In addition, this command removes
 *      all items within an associated memo file.
 *      In a network enviroment, any file that is about to be ZAPped must
 *      be used exclusively.
 *  $EXAMPLES$
 *      USE Tests NEW index Tests
 *      ZAP
 *      USE
 *  $STATUS$
 *      R
 *  $COMPLIANCE$
 *      This command is CA-Cl*pper compliant
 *  $SEEALSO$
 *      DELETE,PACK,USE
 *  $END$
 */

/*  $DOC$
 *  $FUNCNAME$
 *      DELETED()
 *  $CATEGORY$
 *      Database
 *  $ONELINER$
 *      Tests the record's deletion flag.
 *  $SYNTAX$
 *      DELETED() --> lDeleted
 *  $RETURNS$
 *      DELETED() return a logical true (.T.) or false (.F.).
 *  $DESCRIPTION$
 *      This function returns a logical true (.T.) is the current record in the
 *      selected or designated work area ha ben marked for deletion. If not, the
 *      function will return a logical false (.F.).
 *  $EXAMPLES$
 *      FUNCTION Main()
 *      USE Test New
 *      DBGOTO()
 *      DBDELETE()
 *      ? "Is Record Deleted",Test->(DELETED())
 *      DBRECALL()
 *      USE
 *      RETURN NIL
 *  $STATUS$
 *      R
 *  $COMPLIANCE$
 *      This function is CA-Cl*pper compliant
 *  $FILES$
 *      Library is rdd
 *  $SEEALSO$
 *      DBDELETE()
 *  $END$
 */

/*  $DOC$
 *  $FUNCNAME$
 *      EOF()
 *  $CATEGORY$
 *      Database
 *  $ONELINER$
 *      Test for end-of-file condition.
 *  $SYNTAX$
 *      EOF() --> <lEnd>
 *  $RETURNS$
 *      <lEnd> A logical true (.T.) or false (.F.)
 *  $DESCRIPTION$
 *      This function determines if the end-of-file marker has been reached.
 *      If it has, the function will return a logical true (.T.); otherwise
 *      a logical false (.F.) will be returnd
 *  $EXAMPLES$
 *      FUNCTION Main()
 *        USE Tests NEW
 *        DBGOTOP()
 *        ? "Is Eof()",EOF()
 *        DBGOBOTTOM()
 *        ? "Is Eof()",EOF()
 *        USE
 *     RETURN NIL
 *  $STATUS$
 *      R
 *  $COMPLIANCE$
 *      EOF() is fully CA-Cl*pper compliant.
 *  $FILES$
 *      Library is rdd
 *  $SEEALSO$
 *    BOF(),FOUND(),LASTREC()
 *  $END$
 */

/*  $DOC$
 *  $FUNCNAME$
 *      FCOUNT()
 *  $CATEGORY$
 *      Database
 *  $ONELINER$
 *      Counts the number of fields in an active database.
 *  $SYNTAX$
 *      FCOUNT() --> nFields
 *  $RETURNS$
 *      <nFields> Return the number of fields
 *  $DESCRIPTION$
 *      This function returns the number of fields in the current or designated
 *      work area. If no database is open in this work area, the function will
 *      return 0.
 *  $EXAMPLES$
 *      FUNCTION Main()
 *        USE Tests NEW
 *        ? "This database have ",Tests->(FCOUNT()),"Fields"
 *        USE
 *      RETURN Nil
 *  $STATUS$
 *      R
 *  $COMPLIANCE$
 *      This function is CA-Cl*pper compliant
 *  $FILES$
 *      Library is rdd
 *  $SEEALSO$
 *      FIELDNAME(),TYPE()
 *  $END$
 */

/*  $DOC$
 *  $FUNCNAME$
 *      FIELDGET()
 *  $CATEGORY$
 *      Database
 *  $ONELINER$
 *      Obtains the value  of a specified field
 *  $SYNTAX$
 *      FIELDGET(<nField>) --> ValueField
 *  $ARGUMENTS$
 *      <nField> Is the numeric field position
 *  $RETURNS$
 *      <ValueField>  Any expression
 *  $DESCRIPTION$
 *      This function returns the value of the field at the <nField>th location
 *      in the selected or designed work area. If the value in <nField> does not
 *      correspond to n avaliable field position in this work area, the function
 *      will return a NIL data type.
 *  $EXAMPLES$
 *      FUNCTION Main()
 *      USE Test NEW
 *      ? Test->(FieldGet(1))
 *      USE
 *      RETURN NIL
 *  $STATUS$
 *      R
 *  $COMPLIANCE$
 *      This function is CA-Cl*pper Compliant.
 *  $FILES$
 *      Library is rdd
 *  $SEEALSO$
 *      FIELDPUT()
 *  $END$
 */

/*  $DOC$
 *  $FUNCNAME$
 *      FIELDNAME()
 *  $CATEGORY$
 *      Database
 *  $ONELINER$
 *      Return the name of a field at a numeric field location.
 *  $SYNTAX$
 *      FIELDNAME/FIELD(<nPosition>) --> cFieldName
 *  $ARGUMENTS$
 *      <nPosition> Field order in the database.
 *  $RETURNS$
 *      <cFieldName> returns the field name.
 *  $DESCRIPTION$
 *      This function return the name of the field at the <nPosition>th position.
 *      If the numeric value passed to this function does not correspond to an
 *      existing field in the designated or selected work area, this function
 *      will return a NULL byte.
 *  $EXAMPLES$
 *      FUNCTION Main()
 *        LOCAL x
 *        USE Tests NEW
 *        FOR x := 1 to Tests->(FCOUNT())
 *          ? "Field Name",FieldName(x)
 *        NEXT
 *        USE
 *      RETURN Nil
 *  $STATUS$
 *      R
 *  $COMPLIANCE$
 *      This function is CA-Cl*pper compatible.
 *  $FILES$
 *      Library is rdd
 *  $SEEALSO$
 *    DBSTRUCT(),FCOUNT(),LEN(),VALTYPE()
 *  $END$
 */

/*  $DOC$
 *  $FUNCNAME$
 *      FIELDPOS()
 *  $CATEGORY$
 *      Database
 *  $ONELINER$
 *      Return the ordinal position of a field.
 *  $SYNTAX$
 *      FIELDPOS(<cFieldName>) --> nFieldPos
 *  $ARGUMENTS$
 *      <cFieldName> Name of a field.
 *  $RETURNS$
 *      <nFieldPos> is ordinal position of the field.
 *  $DESCRIPTION$
 *      This function return the ordinal position of the specified field <cField>
 *      in the current or aliased work areaIf there isn't field under the name
 *      of <cField> or of no database is open in the selected work area, the func-
 *      tion will return a 0.
 *  $EXAMPLES$
 *      FUNCTION Main()
 *      USE Test NEW
 *      ? Test->(FIELDPOS("ID"))
 *      USE
 *      RETURN NIL
 *  $STATUS$
 *      R
 *  $COMPLIANCE$
 *      This function is CA-Cl*pper compliant.
 *  $FILES$
 *      Library is rdd
 *  $SEEALSO$
 *      FIELDGET(),FIELDPUT()
 *  $END$
 */

/*  $DOC$
 *  $FUNCNAME$
 *      FIELDPUT()
 *  $CATEGORY$
 *      Database
 *  $ONELINER$
 *      Set the value of a field variable
 *  $SYNTAX$
 *      FIELDPUT(<nField>, <expAssign>) --> ValueAssigned
 *  $ARGUMENTS$
 *      <nField> The field numeric position
 *
 *      <expAssign> Expression to be assigned to the specified field
 *  $RETURNS$
 *      <ValueAssigned> Any expression
 *  $DESCRIPTION$
 *      This function assings the value in <expAssing> to the <nField>th
 *      field in the current or designated work area. If the operation is
 *      successful, the return value of the function will be the same value
 *      assigned to the specified field. If the operation is not successful,
 *      the function will return a NIL data type
 *  $EXAMPLES$
 *      USE Tests New
 *      FIELDPUT(1,"Mr. Jones")
 *      USE
 *  $STATUS$
 *      R
 *  $COMPLIANCE$
 *      This function is CA-Cl*pper compatible.
 *  $FILES$
 *      Library is rdd
 *  $SEEALSO$
 *      FIELDGET()
 *  $END$
 */

/*  $DOC$
 *  $FUNCNAME$
 *      FLOCK()
 *  $CATEGORY$
 *      Database
 *  $ONELINER$
 *      Locks a file
 *  $SYNTAX$
 *      FLOCK() --> lSuccess
 *  $RETURNS$
 *      <lSuccess> A true (.T.) value, if the lock was successful;otherwise
 *      false (.F.)
 *  $DESCRIPTION$
 *      This function returns a logical true (.T.) if a file lock is
 *      attempted and is successfully placed on the current or designated
 *      database. This function will also unlock all records locks placed
 *      by the same network station.
 *  $EXAMPLES$
 *      USE Tests New
 *      IF FLOCK()
 *         SUM Tests->Ammount
 *      ENDIF
 *      USE
 *  $STATUS$
 *      R
 *  $COMPLIANCE$
 *      This function is CA-Cl*pper compatible
 *  $FILES$
 *      Library is rdd
 *  $SEEALSO$
 *      RLOCK()
 *  $END$
 */

/*  $DOC$
 *  $FUNCNAME$
 *      FOUND()
 *  $CATEGORY$
 *      Database
 *  $ONELINER$
 *      Determine the success of a previous search operation.
 *  $SYNTAX$
 *      FOUND() --> lSuccess
 *  $ARGUMENTS$
 *      None.
 *  $RETURNS$
 *      <lSuccess> A logical true (.T.) is successful; otherwise, false (.F.)
 *  $DESCRIPTION$
 *      This function is used to test if the previous SEEK, LOCATE, CONTINUE,
 *      or FIND operation was successful. Each wrk area has its own FOUND()
 *      flag, so that a FOUND() condition may be tested in unselected work
 *      areas by using an alias.
 *  $EXAMPLES$
 *      nId:=100
 *      USE Tests NEW INDEX Tests
 *      SEEK nId
 *      IF FOUND()
 *        ? Tests->Name
 *      ENDIF
 *      USE
 *  $STATUS$
 *      R
 *  $COMPLIANCE$
 *      This function is CA-Cl*pper compatible
 *  $FILES$
 *      Library is rdd
 *  $SEEALSO$
 *      EOF()
 *  $END$
 */

/*  $DOC$
 *  $FUNCNAME$
 *      HEADER()
 *  $CATEGORY$
 *      Database
 *  $ONELINER$
 *      Return the length of a database file header
 *  $SYNTAX$
 *      HEADER() --> nBytes
 *  $RETURNS$
 *      <nBytes> The numeric size of a database file header in bytes
 *  $DESCRIPTION$
 *      This function returns the number of bytes in the header of the
 *      selected database ot the database in the designated work area.
 *
 *      If used in conjunction with the LASTREC(), RECSIZE() and DISKSPACE()
 *      functions, this functions is capable of implementing a backup and
 *      restore routine.
 *  $EXAMPLES$
 *      USE Tests New
 *      ? Header()
 *  $STATUS$
 *      R
 *  $COMPLIANCE$
 *      This function is CA-Cl*pper compatible
 *  $FILES$
 *      Library is rdd
 *  $SEEALSO$
 *      DISKSPACE(),LASTREC(),RECSIZE()
 *  $END$
 */

/*  $DOC$
 *  $FUNCNAME$
 *      LASTREC()
 *  $CATEGORY$
 *      Database
 *  $ONELINER$
 *      Returns the number of records in an active work area or database.
 *  $SYNTAX$
 *      LASTREC() | RECCOUNT()* --> nRecords
 *  $RETURNS$
 *      <nRecords > The number of records
 *  $DESCRIPTION$
 *      This function returns the number of records present in the database
 *      in the selected or designated work area. If no records are present
 *      the value of this function will be 0. Additionaly, if no database is
 *      in use in the selected or designated work area, this function will
 *      return a 0 value as well.
 *  $EXAMPLES$
 *      USE Tests NEW
 *      ? LASTREC(), RECCOUNT()
 *  $TESTS$
 *  $STATUS$
 *      R
 *  $COMPLIANCE$
 *      This function is CA-Cl*pper compatible
 *  $PLATFORMS$
 *      All
 *  $FILES$
 *      Library is rdd
 *  $SEEALSO$
 *      EOF()
 *  $END$
 */

/*  $DOC$
 *  $FUNCNAME$
 *      LUPDATE()
 *  $CATEGORY$
 *      Database
 *  $ONELINER$
 *      Yields the date the database was last updated.
 *  $SYNTAX$
 *      LUPDATE() --> dModification
 *  $ARGUMENTS$
 *      None
 *  $RETURNS$
 *      <dModification>  The date of the last modification.
 *  $DESCRIPTION$
 *      This function returns the date recorded by the OS when the selected
 *      or designated database was last written to disk. This function will
 *      only work for those database files in USE.
 *  $EXAMPLES$
 *      Function Main
 *
 *      Use Tests New
 *      ? Lupdate() // 04/25/2000
 *      Use
 *      Return Nil
 *  $TESTS$
 *  $STATUS$
 *      R
 *  $COMPLIANCE$
 *      This function is CA-Cl*pper compliant
 *  $PLATFORMS$
 *      All
 *  $FILES$
 *      Library is rdd
 *  $SEEALSO$
 *      FIELDNAME(),LASTREC(),RECSIZE()
 *  $END$
 */

/*  $DOC$
 *  $FUNCNAME$
 *      NETERR()
 *  $CATEGORY$
 *      Database
 *  $ONELINER$
 *      Tests the success of a network function
 *  $SYNTAX$
 *      NETERR([<lNewError>]) --> lError
 *  $ARGUMENTS$
 *      <lNewError> Is a logical Expression.
 *  $RETURNS$
 *      <lError> A value based on the success of a network operation or
 *      function.
 *  $DESCRIPTION$
 *      This function return a logical true (.T.) is a USE, APPEND BLANK, or
 *      a USE...EXCLUSIVE command is issue and fails in a network enviroment.
 *      In the case of USE and USE...EXCLUSIVE commands, a NETERR() value
 *      of .T. would be returned if another node of the network has the
 *      exclusive use of a file. And the case of the APPEND BLANK command,
 *      NETERR() will return a logical true (.T.) if the file or record
 *      is locked by another node or the value of LASTREC() has been advanced
 *      The value of NETERR() may be changed via the value of <lNewError>.
 *      This allow the run-time error-handling system to control the way
 *      certains errors are handled.
 *  $EXAMPLES$
 *      USE TEST NEW Index Test
 *      If !NetErr()
 *          Seek Test->Name="HARBOUR"
 *          If Found()
 *             ? Test->Name
 *          Endif
 *      Endif
 *      USE
 *  $STATUS$
 *      R
 *  $COMPLIANCE$
 *      This function is CA-Cl*pper compliant
 *  $FILES$
 *      Library is rdd
 *  $SEEALSO$
 *      FLOCK(),RLOCK()
 *  $END$
 */

/*  $DOC$
 *  $FUNCNAME$
 *      RECCOUNT()
 *  $CATEGORY$
 *      Database
 *  $ONELINER$
 *      Counts the number of records in a database.
 *  $SYNTAX$
 *      RECCOUNT()* | LASTREC() --> nRecords
 *  $ARGUMENTS$
 *      None.
 *  $RETURNS$
 *      <nRecords>  The number of records
 *  $DESCRIPTION$*
 *      This function returns the number of records present in the database
 *      in the selected or designated work area. If no records are present
 *      the value of this function will be 0. Additionaly, if no database is
 *      in use in the selected or designated work area, this function will
 *      return a 0 value as well.
 *  $EXAMPLES$
 *      Use Test NEW
 *      USE Harbour NEW
 *      ? Reccount()
 *      ? Test->(RECCOUNT())
 *      CLOSE ALL
 *  $TESTS$
 *  $STATUS$
 *      R
 *  $COMPLIANCE$
 *      This function is CA-Cl*pper compliant
 *  $FILES$
 *      Library is rdd
 *  $SEEALSO$
 *      EOF(),LASTREC(),RECNO(),DBGOBOTTOM()
 *  $END$
 */

/*  $DOC$
 *  $FUNCNAME$
 *      RECNO()
 *  $CATEGORY$
 *      Database
 *  $ONELINER$
 *      Returns the current record number or identity.
 *  $SYNTAX$
 *      RECNO() --> Identity
 *  $ARGUMENTS$
 *      None.
 *  $RETURNS$
 *      RECNO() The record number or indentity
 *  $DESCRIPTION$
 *      This function returns the position of the record pointer in the
 *      currently selected ot designated work area.
 *      If the database file is empty and if the RDD is the traditional .dbf
 *      file, the value of this function will be 1.
 *  $EXAMPLES$
 *      USE Tests NEW
 *      DBGOTOP()
 *      RECNO()            // Returns 1
 *      DBGOTO(50)
 *      RECNO()            // Returns 50
 *  $TESTS$
 *  $STATUS$
 *      R
 *  $COMPLIANCE$
 *      This function is CA-Cl*pper compliant
 *  $FILES$
 *      Library is rdd
 *  $SEEALSO$
 *      DBGOTO(),DBGOTOP(),DBGOBOTTOM(),LASTREC(),EOF(),BOF()
 *  $END$
 */

/*  $DOC$
 *  $FUNCNAME$
 *      RECSIZE()
 *  $CATEGORY$
 *      Database
 *  $ONELINER$
 *      Returns the size of a single record in an active database.
 *  $SYNTAX$
 *      RECSIZE() --> nBytes
 *  $ARGUMENTS$
 *      None.
 *  $RETURNS$
 *      <nBytes> The record size.
 *  $DESCRIPTION$
 *      This function returns the number os bytes used by a single record
 *      in the currently selected or designated database file. If no database
 *      is in use in this work area, the return value from this function
 *      will be 0.
 *  $EXAMPLES$
 *      USE Tests NEW
 *      DBGOTOP()
 *      RECSIZE()            // Returns 1
 *      DBGOTO(50)
 *      RECSIZE()
 *  $TESTS$
 *  $STATUS$
 *      R
 *  $COMPLIANCE$
 *      This function is CA-Cl*pper compliant
 *  $FILES$
 *      Library is rdd
 *  $SEEALSO$
 *      DISKSPACE(),FIELDNAME(),HEADER(),LASTREC()
 *  $END$
 */

/*  $DOC$
 *  $FUNCNAME$
 *      RLOCK()
 *  $CATEGORY$
 *      Database
 *  $ONELINER$
 *      Lock a record in a work area
 *  $SYNTAX$
 *      RLOCK() --> lSuccess
 *  $ARGUMENTS$
 *      None
 *  $RETURNS$
 *      RLOCK() True (.T.) if record lock is successful; otherwise, it
 *      returns false (.F.).
 *  $DESCRIPTION$
 *      This function returns a logical true (.T.) if an attempt to lock a
 *      specific record in a selected or designated work area is successful.
 *      It will yield a false (.F.) if either the file or the desired record
 *      is currently locked.
 *      A record that is locked remains locked until another RLOCK() is issued
 *      or until an UNLOCK command is executed.
 *      On a Network enviroment the follow command need that the record is
 *      locked:
 *
 *      @...GET
 *
 *      DELETE (single record)
 *
 *      RECALL (single record)
 *
 *      REPLACE (single record)
 *  $EXAMPLES$
 *      nId:=10
 *      USE TestId INDEX TestId NEW
 *      IF TestId->(DBSEEK(nId))
 *         IF TestId->(RLOCK())
 *            DBDELETE()
 *         ENDIF
 *      ENDIF
 *      USE
 *  $TESTS$
 *  $STATUS$
 *      R
 *  $COMPLIANCE$
 *      This function is CA-Cl*pper compliant
 *  $FILES$
 *      Library is rdd
 *  $SEEALSO$
 *      FLOCK()
 *  $END$
 */

/*  $DOC$
 *  $FUNCNAME$
 *      SELECT()
 *  $CATEGORY$
 *      Database
 *  $ONELINER$
 *      Returns the work area number for a specified alias.
 *  $SYNTAX$
 *      SELECT([<cAlias>]) --> nWorkArea
 *  $ARGUMENTS$
 *      <cAlias> is the target work area alias name.
 *  $RETURNS$
 *      SELECT() returns the work area number.
 *  $DESCRIPTION$
 *      This function returns the work area number for the specified alias
 *      name <cAlias>. If no parameter is specified, the current work area will
 *      be the return value of the function.
 *  $EXAMPLES$
 *      USE TESTS NEW
 *      USE NAMES NEW
 *      cOldArea:=SELECT("NAMES")
 *      select TEST
 *      LIST
 *      SELECT cOldArea
 *  $TESTS$
 *  $STATUS$
 *      R
 *  $COMPLIANCE$
 *      This function is CA-Cl*pper compliant
 *  $FILES$
 *      Library is rdd
 *  $SEEALSO$
 *      ALIAS(), USED()
 *  $END$
 */

/*  $DOC$
 *  $FUNCNAME$
 *      USED()
 *  $CATEGORY$
 *      Database
 *  $ONELINER$
 *      Checks whether a database is in use in a work area
 *  $SYNTAX$
 *      USED() --> lDbfOpen
 *  $ARGUMENTS$
 *      None.
 *  $RETURNS$
 *      <lDbfOpen> True is a database is Used;otherwise False
 *  $DESCRIPTION$
 *      This function returns a logical true (.T.) if a database file is in
 *      USE in the current or designated work area. If no alias is specified
 *      along with this function , it will default to the currently selected
 *      work area.
 *  $EXAMPLES$
 *      Use TESTS NEW
 *      USE Names New
 *      ? USED()    // .T.
 *      ? TESTS->(USED()) //.T.
 *      CLOSE
 *      ? USED()  // .F.
 *      Select TESTS
 *      ? USED() //.T.
 *
 *  $TESTS$
 *  $STATUS$
 *      R
 *  $COMPLIANCE$
 *      This function is CA-Cl*pper Compliant
 *  $FILES$
 *      Library is rdd
 *  $SEEALSO$
 *      ALIAS(), SELECT()
 *  $END$
 */

/*  $DOC$
 *  $COMMANDNAME$
 *      PACK
 *  $CATEGORY$
 *      Command
 *  $ONELINER$
 *      Remove records marked for deletion from a database
 *  $SYNTAX$
 *      PACK
 *  $DESCRIPTION$
 *      This command removes records that were marked for deletion from the
 *      currently selected database. This command does not pack the contents
 *      of a memo field; those files must be packed via low-level fuctions.
 *
 *      All open index files will be automatically reindexed once PACK command
 *      has completed its operation. On completion, the record pointer is placed
 *      on the first record in the database.
 *  $EXAMPLES$
 *      USE Tests NEW index Tests
 *      DBGOTO(10)
 *      DELETE NEXT 10
 *      PACK
 *      USE
 *  $STATUS$
 *      R
 *  $COMPLIANCE$
 *      This command is CA-Cl*pper compliant
 *  $SEEALSO$
 *      DBEVAL(), DELETE, DELETED(), ZAP, RECALL
 *  $END$
 */
