ZAP

ZAP

Remove all records from the current database file

Syntax

      ZAP

Arguments

(This command has no arguments)

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

Compliance

Clipper

Seealso

DELETE, PACK, USE

Used()

Used()

Checks whether a database is in use in a work area

Syntax

      Used() --> lDbfOpen

Arguments

(This function has no arguments)

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.

Compliance

Clipper

Files

Library is rdd

Seealso

Alias(), Select()

Select()

Select()

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

Compliance

Clipper

Files

Library is rdd

Seealso

Alias(), Used()

RLock()

RLOCK()

Lock a record in a work area

Syntax

      RLOCK() --> lSuccess

Arguments

(This function has no arguments)

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

Compliance

Clipper

Files

Library is rdd

Seealso

FLOCK()

RecSize()

RECSIZE()

Returns the size of a single record in an active database.

Syntax

      RECSIZE() --> nBytes

Arguments

(This function has no arguments)

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()

Compliance

Clipper

Files

Library is rdd

Seealso

DISKSPACE(), FIELDNAME(), HEADER(), LASTREC()

RecNo()

RECNO()

Returns the current record number or identity.

Syntax

      RECNO() --> Identity

Arguments

(This function has no arguments)

Returns

RECNO() The record number or identity

Description

This function returns the position of the record pointer in the currently selected or 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

Compliance

Clipper

Files

Library is rdd

Seealso

DBGOTO(), DBGOTOP(), DBGOBOTTOM(), LASTREC(), EOF(), BOF()

RecCount()

RECCOUNT()

Counts the number of records in a database.

Syntax

      RECCOUNT()* | LASTREC() --> nRecords

Arguments

(This function has no arguments)

Returns

<nRecords> The number of records

Descriptions

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

Compliance

Clipper

Files

Library is rdd

Seealso

EOF(), LASTREC(), RECNO(), DBGOBOTTOM()

PACK

PACK

Remove records marked for deletion from a database

Syntax

      PACK

Arguments

(This command has no arguments)

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

Compliance

Clipper

Seealso

DBEVAL(), DELETE, DELETED(), ZAP, RECALL

NetErr()

NETERR()

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

Compliance

Clipper

Files

Library is rdd

Seealso

FLOCK(), RLOCK()

LUpdate()

LUPDATE()

Yields the date the database was last updated.

Syntax

      LUPDATE() --> dModification

Arguments

(This function has no arguments)

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

      PROCEDURE Main()
         USE tests NEW
         ? LUpdate()
         USE
         RETURN

Compliance

Clipper

Platforms

All

Files

Library is rdd

Seealso

FIELDNAME(), LASTREC(), RECSIZE()