Difference between revisions of "SET COMPATIBLE"

From Recital Documentation Wiki
Jump to: navigation, search
(Description)
Line 68: Line 68:
  
 
ADIR()
 
ADIR()
 +
 
ADIR() is compatible with FoxPro behavior.
 
ADIR() is compatible with FoxPro behavior.
  
 
DBF()
 
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).
 
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()
 
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).
 
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()
 
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).
 
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()
 
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).
 
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).
  
Line 85: Line 90:
  
 
File specifications
 
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)).
 
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.
 
The == operator always operates as an ’exact match’ operator and does not allow wildcard pattern matching.
  
 
   
 
   
 
AFIELDS()
 
AFIELDS()
 +
 
If SET COMPATIBLE is set to FOXPRO | FOXPLUS | FOXBASE | VFP the array need not be pre-defined, it will be created automatically.
 
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
 
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.
 
If SET COMPATIBLE is set to FOXPRO | FOXPLUS | FOXBASE | VFP the array need not be pre-defined, it will be created automatically.
  
 
DTOS()
 
DTOS()
 +
 
The DTOS() function, when used on an empty date, will return a string of 8 spaces rather than a string of 8 zeroes.
 
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
 +
 
SET FULLPATH is set ON by default.
 
SET FULLPATH is set ON by default.
  
Line 106: Line 117:
  
 
ARRAY
 
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.
 
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
 
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.
 
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()
 
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.
 
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()
 
MENU()
 +
 
The MENU() function will return the name of the activated menu instead of the ordinal number of the menu item chosen.
 
The MENU() function will return the name of the activated menu instead of the ordinal number of the menu item chosen.
  
 
PROGRAM() | PROCNAME()
 
PROGRAM() | PROCNAME()
 +
 
The PROGRAM() and PROCNAME() functions return a string in upper case instead of a string in lower case.
 
The PROGRAM() and PROCNAME() functions return a string in upper case instead of a string in lower case.
  
 
SELECT([<expN>])
 
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.
 
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()
 
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.
 
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)
 
SYS(5)
 +
 
The SYS(5) function will return ’C:’
 
The SYS(5) function will return ’C:’
  
Line 133: Line 152:
  
 
ASTORE()
 
ASTORE()
 +
 
The ASTORE() function will not trim the strings that are stored in the array passed to ASTORE().
 
The ASTORE() function will not trim the strings that are stored in the array passed to ASTORE().
  
 
CREATE
 
CREATE
 +
 
In a program the command CREATE <filename> will create an empty table with the following structure.
 
In a program the command CREATE <filename> will create an empty table with the following structure.
  
Line 152: Line 173:
  
 
FILE()
 
FILE()
 +
 
The FILE() function will not concatenate ’.dbf’ to the parameter, if the parameter passed does not have a file extension.
 
The FILE() function will not concatenate ’.dbf’ to the parameter, if the parameter passed does not have a file extension.
  
 
GOTO
 
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.
 
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()
 
MEMOEDIT()
 +
 
The parameters that are passed to MEMOEDIT() are compatible with CLIPPER.
 
The parameters that are passed to MEMOEDIT() are compatible with CLIPPER.
  
PARAMETER
+
PARAMETERS
If fewer parameters are passed to a procedure or a function than are declared with the PARAMETER statement, the extra variables are set to type UNDEFINED instead of LOGICAL.
+
 
 +
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
 
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.
 
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
 
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.
 
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()
 
SECONDS()
 +
 
The SECONDS() function will return the same value as SECS() function.
 
The SECONDS() function will return the same value as SECS() function.
  
 
SKIP 0
 
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.
 
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.
  
Line 201: Line 230:
  
 
ENDFUNC
 
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).
 
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
 
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).
 
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 | 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.
 
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  
 
The FUNCTION command supports parameter declaration in the format  
Line 212: Line 244:
  
 
ID()
 
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:
 
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
 
MACHINEID # userid
 
  
 
==Example==
 
==Example==

Revision as of 16:37, 10 March 2009

SET COMPATIBLE

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

APPEND, CHANGE, EDIT, EDITFIELD(), FILETYPE(), INDEXEXT(), SET CLIPPER, SET CLIPPER5, SET EDITFIELD, SET FILECASE, SET FILETYPE, SET INDEXEXT, SET MEMOEXT, SET PCEDIT, SET PCEXACT, SET PCFILTER, SET PCGRAPHICS, SET PCKEYS, SET PCLOCKING, SET PCPICTURE, SET PCSAYS, SET PCUNIQUE, DB_COMPMULICOMM, DB_FOXMEM, DB_FOXPLUSBUGS, DB_FOXPROKEYS, DB_SAMBA


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 compat.db file resides in the Recital Terminal Developer home directory. 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 compat.db file does not exist in the Recital Terminal Developer home directory.

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 ’.’.

  1. SET PCEXACT
  2. SET PCUNIQUE
  3. SET PCFILTER
  4. SET PCLOCKING
  5. 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.


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 recital
?set("talk")
.T.


Products

Recital Database Server, Recital Mirage Server, Recital Terminal Developer