DBASE III FUNCTIONS & STATEMENTS

DBASE III FUNCTIONS & STATEMENTS

PPL provide a load of functions & statements to access DBase III files…

STATEMENTS

	DCREATE    channel,name,exclusive,fieldInfo ; create DBF file
	DOPEN      channel,name,exclusive           ; open DBF file
	DCLOSE     channel                          ; close DBF file
	DSETALIAS  channel,name                     ; set DBF alias
	DPACK      channel                          ; pack DBF file
	DLOCK      channel                          ; lock DBF file
	DLOCKF     channel                          ; lock DBF file (same as DLOCK)
	DLOCKR     channel,recno                    ; lock a record
	DLOCKG     channel,recnos,count             ; lock a group of records
	DUNLOCK    channel                          ; unlock any current locks
	DNCREATE   channel,name,expression          ; create NDX file
	DNOPEN     channel,name                     ; open NDX file
	DNCLOSE    channel,name                     ; close NDX file
	DNCLOSEALL channel                          ; close all NDX files
	DNEW       channel                          ; start a new record
	DADD       channel                          ; add the new record
	DAPPEND    channel                          ; append a blank record
	DTOP       channel                          ; go to top record
	DGO        channel,recno                    ; go to specific record
	DBOTTOM    channel                          ; go to bottom record
	DSKIP      channel,number                   ; skip +/- a number of records
	DBLANK     channel                          ; blank the record
	DDELETE    channel                          ; delete the record
	DRECALL    channel                          ; recall the record
	DTAG       channel,name                     ; select a tag
	DSEEK      channel,expression               ; string or double
	DFBLANK    channel,name                     ; blank a named field
	DGET       channel,name,var                 ; get a value from a named field
	DPUT       channel,name,expression          ; put a value to a named field
	DFCOPY     channel,name,channel,name        ; copy a field to a field
	DCLOSEALL                                   ; close all DBF files

FUNCTIONS

	DRECCOUNT (channel)        (INTEGER)        ; return the number of records
	DRECNO    (channel)        (INTEGER)        ; return the current record number
	DBOF      (channel)        (BOOLEAN)        ; return the begin of file status
	DEOF      (channel)        (BOOLEAN)        ; return the end of file status
	DDELETED  (channel)        (BOOLEAN)        ; return the deleted flag
	DCHANGED  (channel)        (BOOLEAN)        ; return the changed flag
	DFIELDS   (channel)        (INTEGER)        ; return count of fields
	DNAME     (channel,number) (STRING)         ; return name of numbered field
	DTYPE     (channel,name)   (STRING)         ; return type of named field
	DLENGTH   (channel,name)   (INTEGER)        ; return length of named field
	DDECIMALS (channel,name)   (INTEGER)        ; return decimals of named field
	DSELECT   (alias)          (INTEGER)        ; returns channel assiciated with alias
	DSEEK     (channel,expression) (INTEGER)    ; returns error status ( 0|1 )
						    ; or seek success (0 = Error
						    ; 1 = success, 2 = following record
						    ; 3 = end of file )
	DGETALIAS (channel)        (STRING)                 ; return the current alias
	DCLOSEALL                  (BOOLEAN) error status   ; close all DBF files
	DOPEN     (channel,name,exclusive)(BOOLEAN) error   ; open DBF file
	DCLOSE    (channel)        (BOOLEAN) error status   ; close DBF file
	DSETALIAS (channel,name)   (BOOLEAN) error status   ; set DBF alias
	DPACK     (channel)        (BOOLEAN) error status   ; pack DBF file
	DLOCK     (channel)        (BOOLEAN) error status   ; lock DBF file
	DLOCKR    (channel,recno)  (BOOLEAN) error status   ; lock a record
	DUNLOCK   (channel)        (BOOLEAN) error status   ; unlock any current locks
	DNOPEN    (channel,name)   (BOOLEAN) error status   ; open NDX file
	DNCLOSE   (channel,name)   (BOOLEAN) error status   ; close NDX file
	DNCLOSEALL(channel)        (BOOLEAN) error status   ; close all NDX files
	DNEW      (channel)        (BOOLEAN) error status   ; start a new record
	DADD      (channel)        (BOOLEAN) error status   ; add the new record
	DAPPEND   (channel)        (BOOLEAN) error status   ; append a blank record
	DTOP      (channel)        (BOOLEAN) error status   ; go to top record
	DGO       (channel,recno)  (BOOLEAN) error status   ; go to specific record
	DBOTTOM   (channel)        (BOOLEAN) error status   ; go to bottom record
	DSKIP     (channel,number) (BOOLEAN) error status   ; skip +/- a number of records
	DBLANK    (channel)        (BOOLEAN) error status   ; blank the record
	DDELETE   (channel)        (BOOLEAN) error status   ; delete the record
	DRECALL   (channel)        (BOOLEAN) error status   ; recall the record
	DTAG      (channel,name)   (BOOLEAN) error status   ; select a tag
	DFBLANK   (channel,name)   (BOOLEAN) error status   ; blank a named field
	DGET      (channel,name)   (STRING)                 ; get a value from a named field
	DPUT      (channel,name,expression)(BOOLEAN) error  ; put a value to a named field
	DFCOPY    (channel,name,channel,name)(BOOLEAN) error; copy a field to a field
	DERR      (channel)        (BOOLEAN)        	    ; return error flag for channel
	DERRMSG   (errcode)        (STRING)        	    ; returns last DBase error text.

CAUTION: DBase functions that return the error status actually return !ERROR. This is to provide a consistent way to express an error in an expression.
For example:
if ( DERR (…)) println “Error!”

   ;DERR  returns 1 or TRUE on an error.
		if (!DSEEK(...)) println "Seek failed!" ;DSEEK returns 0 or FALSE on an error.

NOTE:
Where file names are used, file extensions are optional. Any extension you provide will be ignored. DBF and IDX are the default.

	channel:    Any value between 0 and 7
	name:       Char string
	exclusive:  Integer (TRUE || FALSE)
	fieldinfo:  Character string with the following fields
				1- Field name
				2- Field Type
					C = Character
					N = Numeric
					F = Floating Point
					D = Date
					L = Logical
					M = Memo
				3- Field Length
				4- Decimal (number of digits to the right of the decimal)

EXAMPLE:

	string finfo(3)
	let finfo(0) = "First,C,20,0"
	let finfo(1) = "Last,C,20,0"
	let finfo(2) = "Phone,C,15,0"

NOTE:
Multiple fields require an array of strings. 1 string for each field. expression : Character String with search criteria on a field.

EXAMPLE:

	string expr
	let expr = "First"
	recno,recnos,number,count: integers

Tags: ppl dbase db

ppl/dbase-functions-statements.txt · Last modified: 2019/04/12 15:18
CC Attribution 4.0 International Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution 4.0 International