SET COMPATIBLE

From Recital Documentation Wiki
Revision as of 11:58, 19 June 2009 by Yvonnemilne (Talk | contribs)

Jump to: navigation, search

Class

Xbase Compatibility


Purpose

Enhance Recital’s compatibility with other Xbase products


Syntax

SET COMPATIBLE [TO | ON | OFF]

SET COMPATIBLE [TO] DBASE3 | DBASE4 | DB4 | FOXPRO | FOXPLUS | FOXBASE | CLIPPER | CLIPPER5 | RECITAL | VFP


See Also

ADIR(), AFIELDS(), APPEND, ASTORE(), BROWSE, CHANGE, COPY, CREATE, DB_COMPMULICOMM, DB_FOXMEM, DB_FOXPLUSBUGS, DB_FOXPROKEYS, DB_SAMBA, DBF(), DTOS(), EDIT, EDITFIELD(), FILE(), FILETYPE(), FMT(), FUNCTION, GOTO, ID(), INDEXEXT(), INDEXORDER(), MDX(), MEMOEDIT(), MENU(), NDX(), ORDER(), PARAMETERS, PRIVATE, PROCEDURE, PROCNAME(), PROGRAM(), PUBLIC, RESTORE SCREEN, SAVE SCREEN, SECONDS(), SELECT(), SET BLOCKSIZE, SET CLIPPER, SET CLIPPER5, SET DBTRAP, SET EDITFIELD, SET FILECASE, SET FILETYPE, SET FULLPATH, SET IBLOCK, SET INDEXEXT, SET LDCHECK, SET MBLOCK, SET MEMOEXT, SET PCEDIT, SET PCEXACT, SET PCFILTER, SET PCGRAPHICS, SET PCKEYS, SET PCLOCKING, SET PCPICTURE, SET PCSAYS, SET PCUNIQUE, SET PROMPT, SET(), SKIP, SYS(), USE, VERSION()


Description

The SET COMPATIBLE command is used to enhance compatibility with other Xbase products. Certain functions and commands behave differently depending on which keyword is used with the SET COMPATIBLE command.

In Recital Terminal Developer, if SET COMPATIBLE is issued with no ON, OFF or TO clause, the Xbase Compatibility Settings dialog is displayed. This allows the system-wide Language and Database Compatibility settings to be selected. These correspond to the SET COMPATIBLE and SET FILETYPE settings and once saved are written to the compat.db file, which will be run every time Recital Terminal Developer is started. The following choices are available:


  • Recital
  • Visual FoxPro
  • FoxPro
  • FoxBase
  • dBASE IV
  • dBase 3
  • Clipper 5
  • Clipper ’87


The Xbase Compatibility Settings dialog is also displayed the first time you start Recital Terminal Developer after a new install or at any subsequent startup when the system compat.db file does not exist.

The keywords ON, DBASE4, and DB4 perform the same function, that is, provide compatibility with dBase IV.


When SET COMPATIBLE is set to any mode except RECITAL, the following SET commands are turned on. SET PROMPT is also set to ’.’.


  • SET PCEXACT
  • SET PCUNIQUE
  • SET PCFILTER
  • SET PCLOCKING
  • SET PCKEYS


In any compatibility mode other than RECITAL, the AGAIN clause of the USE command allows the same table to be reopened in another workarea in the same session.


Language Memo Index Production
DBASE3 dbt ndx mdx
DBASE4 dbt ndx mdx
CLIPPER dbt ntx
FOXBASE dbt idx cdx
FOXPRO fpt idx cdx
VFP fpt idx cdx


When COMPATIBLE is set to FOXPRO | VFP, the following changes apply:

ADIR()

ADIR() is compatible with FoxPro behavior.

DBF()

If SET FULLPATH is ON the full path to the database table is returned, if SET FILECASE is OFF then the return value is converted to upper case (Windows only).

FMT()

If SET FULLPATH is ON the full path to the format file is returned, if SET FILECASE is OFF then the return value is converted to upper case (Windows only).

MDX()

If SET FULLPATH is ON the full path to the index file is returned, if SET FILECASE is OFF then the return value is converted to upper case (Windows only).

NDX()

If SET FULLPATH is ON the full path to the index file is returned, if SET FILECASE is OFF then the return value is converted to upper case (Windows only).

When COMPATIBLE is set to FOXBASE | FOXPLUS | FOXPRO | VFP, the following changes apply:

File specifications

File specifications can also be character expressions, e.g. APPEND FROM DBF(2). In other compatibility modes, the character expression must be enclosed in parentheses, e.g. APPEND FROM (DBF(2)).

==

The == operator always operates as an ’exact match’ operator and does not allow wildcard pattern matching.

AFIELDS()

If SET COMPATIBLE is set to FOXPRO | FOXPLUS | FOXBASE | VFP the array need not be pre-defined, it will be created automatically.

COPY TO ARRAY

If SET COMPATIBLE is set to FOXPRO | FOXPLUS | FOXBASE | VFP the array need not be pre-defined, it will be created automatically.

DTOS()

The DTOS() function, when used on an empty date, will return a string of 8 spaces rather than a string of 8 zeroes.

SET FULLPATH

SET FULLPATH is set ON by default.

When compatibility is set to DBASE4 or to FOXBASE | FOXPLUS | FOXPRO | VFP the following changes apply:

ARRAY

The word ARRAY is recognized as an optional keyword to the LOCAL, PUBLIC, PRIVATE and DECLARE commands when compatibility is set to DBASE4 or FOXPRO. Normally, Recital allows the word ARRAY to be used as a memory variable name.

BROWSE

When BROWSE is activated in a window the BROWSE menu will not be shown until the [MENUBAR] key is pressed. Normally the BROWSE menu is displayed when BROWSE is activated.

INDEXORDER() | ORDER()

The INDEXORDER() and ORDER() functions will return the name of the master .ndx or master .dbx tag instead of the ordinal number of the index in the index list.

MENU()

The MENU() function will return the name of the activated menu instead of the ordinal number of the menu item chosen.

PROGRAM() | PROCNAME()

The PROGRAM() and PROCNAME() functions return a string in upper case instead of a string in lower case.

SELECT([<expN>])

If <expN> is 0, the SELECT() function will return the currently selected workarea. If <expN> is 1, the SELECT() function will return the highest available empty workarea.

SET()

The SET() function will return a string instead of a logical value. In many cases, when SET COMPATIBLE is set to DB4, SET() will return ON or OFF. In other cases SET() will return a setting, for example, SET("BORDER") might return DOUBLE.

SYS(5)

The SYS(5) function will return ’C:’


When SET COMPATIBLE is set to CLIPPER the following commands and functions are affected.

ASTORE()

The ASTORE() function will not trim the strings that are stored in the array passed to ASTORE().

CREATE

In a program the command CREATE <filename> will create an empty table with the following structure.


Name Type Width Description
FIELD_NAME Character 32 Field name
FIELD_TYPE Character 1 Field data type
FIELD_LEN Numeric 3 Width of fields
FIELD_DEC Numeric 3 Number of decimals


FILE()

The FILE() function will not concatenate ’.dbf’ to the parameter, if the parameter passed does not have a file extension.

GOTO

If the record number qualifier of the GOTO command is less than zero or greater than the number of records, an error message is not generated and EOF() is set to TRUE and FOUND() is set to FALSE.

MEMOEDIT()

The parameters that are passed to MEMOEDIT() are compatible with CLIPPER.

PARAMETERS

If fewer parameters are passed to a procedure or a function than are declared with the PARAMETERS statement, the extra variables are set to type UNDEFINED instead of LOGICAL.

PUBLIC | PRIVATE

Memory variables created with a PUBLIC or PRIVATE statement are created with a type of UNDEFINED. The TYPE() function will return "U" for undefined variables.

SAVE | RESTORE SCREEN

The SAVE and RESTORE SCREEN command without any qualifiers, will only SAVE and RESTORE one screen. Normally Recital allows 20 screens to be saved and restored.

SECONDS()

The SECONDS() function will return the same value as SECS() function.

SKIP 0

When a SKIP 0 command is executed, the record buffer is flushed to disk. This command is most useful when used in validation procedures that are called from forms and REPLACE commands are used within the validation procedure.

VERSION()

The VERSION() function will have a different value as outlined below:


Language VERSION()
DB4 dBASE IV 2.0
CLIPPER Clipper Summer ’87
CLIPPER5 Clipper 5
FOXPLUS FoxBASE+ 2.10
FOXPRO FoxPro 2.6
VFP Visual FoxPro 06.00 for Windows


{}

When SET COMPATIBLE is set to CLIPPER5, curly braces ’{}’ are interpreted as array size delimiters, not date delimiters.

When SET COMPATIBLE is set to VFP, the following changes apply:

ENDFUNC

The ENDFUNC command can be used to terminate a function. If no explicit return value is set, the return value will be .T. (true).

ENDPROC

The ENDPROC command can be used to terminate a procedure. If no explicit return value is set, the return value will be .T. (true).

FUNCTION | PROCEDURE

FUNCTION and PROCEDURE definitions in procedure libraries do not require a RETURN statement (or ENDFUNC | ENDPROC) as they will be terminated by the next FUNCTION | PROCEDURE definition. The FUNCTION command supports parameter declaration in the format FUNCTION function-name(parameter-list).

ID()

The ID() function returns a string in the following format, returning the machine id and the user id rather than just the user id:

MACHINEID # userid

Example

set compatible dbase4
?set("talk")
ON
set compatible to recital
?set("talk")
.T.


Products

Recital Database Server, Recital Mirage Server, Recital Terminal Developer