SP_SETEXACT

SETEXACT()

  Short:
  ------
  SETEXACT() Determines if exact is on/off

  Returns:
  --------
  <lExact> => Exact is on/off

  Syntax:
  -------
  SETEXACT([lNew])

  Description:
  ------------
  Returns current SET EXACT setting and optionally sets
  exact on/off with [lNew]  .t. = ON .f. = OFF

  Examples:
  ---------
   nOldexact = SETEXACT(.f.) // SET EXACT OFF

   * code

   SETEXACT(nOldexact)

  Source:
  -------
  S_SETEX.PRG


 

C5_SET EXACT

SET EXACT*
 Toggle exact matches for character strings
------------------------------------------------------------------------------
 Syntax

     SET EXACT on | OFF | <xlToggle>

 Arguments

     ON enforces exact comparison of character strings including length.

     OFF resumes normal character string comparison.

     <xlToggle> is a logical expression that must be enclosed in
     parentheses.  A value of true (.T.) is the same as ON, and a value of
     false (.F.) is the same as OFF.

 Description

     SET EXACT determines how two character strings are compared using the
     relational operators (=, >, <, =>, =<).  When EXACT is OFF, strings are
     compared according to the following rules.  assume two character strings
     cLeft and cRight where the expression to test is (cLeft = cRight):

     .  If cRight is a null string (""), return true (.T.).

     .  If LEN(cRight) is greater than LEN(cLeft), return false (.F.).

     .  Otherwise, compare all characters in cRight with cLeft.  If
        all characters in cRight equal cLeft, return true (.T.); otherwise,
        return false (.F.).

     With EXACT ON, all relational operators except the double equal operator
     (==) treat two strings as equal, if they match exactly, excluding
     trailing spaces.  With the double equal operator (==), all characters in
     the string are significant, including trailing spaces.

     SET EXACT is a compatibility command and not recommended.

 Notes

     .  Compatibility: In Clipper, unlike other dialects, SET EXACT
        has no affect on operations other than relational operators.  This
        includes the SEEK and FIND commands.  If you need to seek exact
        matches of character keys, use the example user-defined function
        SeekExact() in the SEEK command reference.

 Examples

     .  These examples show various results of the equal operator (=)
        with SET EXACT:

        SET EXACT OFF
        ? "123" = "12345"            // Result: .F.
        ? "12345" = "123"            // Result: .T.
        ? "123" = ""                 // Result: .T.
        ? "" = "123"                 // Result: .F.
        ? "123" = "123  "            // Result: .F.
        //
        SET EXACT ON
        ? "123" = "12345"            // Result: .F.
        ? "12345" = "123"            // Result: .F.
        ? "123" = ""                 // Result: .F.
        ? "" = "123"                 // Result: .F.
        ? "123" = "123  "            // Result: .T.

 Files   Library is CLIPPER.LIB.

See Also: SEEK



C5 Commands

 ?|??            Display one or more values to the console
 @...BOX         Draw a box on the screen
 @...CLEAR       Clear a rectangular region of the screen
 @...GET         Create a new Get object and display it
 @...PROMPT      Paint a menu item and define a message
 @...SAY         Display data at a specified screen or printer row and column
 @...TO          Draw a single- or double-line box
 ACCEPT*         Place keyboard input into a memory variable
 APPEND BLANK    Add a new record to the current database file
 APPEND FROM     Import records from a database (.dbf) file or ASCII text file
 AVERAGE         Average numeric expressions in the current work area
 CALL*           Execute a C or Assembler procedure
 CANCEL*         Terminate program processing
 CLEAR ALL*      Close files and release public and private variables
 CLEAR GETS      Release Get objects from the current GetList array
 CLEAR MEMORY    Release all public and private variables
 CLEAR SCREEN    Clear the screen and return the cursor home
 CLEAR TYPEAHEAD Empty the keyboard buffer
 CLOSE           Close a specific set of files
 COMMIT          Perform a solid-disk write for all active work areas
 CONTINUE        Resume a pending LOCATE
 COPY FILE       Copy a file to a new file or to a device
 COPY STRUCTURE  Copy the current .dbf structure to a new database (.dbf) file
 COPY STRU EXTE  Copy field definitions to a .dbf file
 COPY TO         Export records to a database (.dbf) file or ASCII text file
 COUNT           Tally records to a variable
 CREATE          Create an empty structure extended (.dbf) file
 CREATE FROM     Create a new .dbf file from a structure extended file
 DELETE          Mark records for deletion
 DELETE FILE     Remove a file from disk
 DELETE TAG      Delete a tag
 DIR*            Display a listing of files from a specified path
 DISPLAY         Display records to the console
 EJECT           Advance the printhead to top of form
 ERASE           Remove a file from disk
 FIND*           Search an index for a specified key value
 GO              Move the pointer to the specified identity
 INDEX           Create an index file
 INPUT*          Enter the result of an expression into a variable
 JOIN            Create a new database file by merging from two work areas
 KEYBOARD        Stuff a string into the keyboard buffer
 LABEL FORM      Display labels to the console
 LIST            List records to the console
 LOCATE          Search sequentially for a record matching a condition
 MENU TO         Execute a lightbar menu for defined PROMPTs
 NOTE*           Place a single-line comment in a program file
 PACK            Remove deleted records from a database file
 QUIT            Terminate program processing
 READ            Activate full-screen editing mode using Get objects
 RECALL          Restore records marked for deletion
 REINDEX         Rebuild open indexes in the current work area
 RELEASE         Delete public and private memory variables
 RENAME          Change the name of a file
 REPLACE         Assign new values to field variables
 REPORT FORM     Display a report to the console
 RESTORE         Retrieve memory variables from a memory (.mem) file
 RESTORE SCREEN* Display a saved screen
 RUN             Execute a DOS command or program
 SAVE            Save variables to a memory (.mem) file
 SAVE SCREEN*    Save the current screen to a buffer or variable
 SEEK            Search an order for a specified key value
 SELECT          Change the current work area
 SET ALTERNATE   Echo console output to a text file
 SET BELL        Toggle sounding of the bell during full-screen operations
 SET CENTURY     Modify the date format to include or omit century digits
 SET COLOR*      Define screen colors
 SET CONFIRM     Toggle required exit key to terminate GETs
 SET CONSOLE     Toggle console display to the screen
 SET CURSOR      Toggle the screen cursor on or off
 SET DATE        Set the date format for input and display
 SET DECIMALS    Set the number of decimal places to be displayed
 SET DEFAULT     Set the CA-Clipper default drive and directory
 SET DELETED     Toggle filtering of deleted records
 SET DELIMITERS  Toggle or define GET delimiters
 SET DESCENDING  Change the descending flag of the controlling order
 SET DEVICE      Direct @...SAYs to the screen or printer
 SET EPOCH       Control the interpretation of dates with no century digits
 SET ESCAPE      Toggle Esc as a READ exit key
 SET EXACT*      Toggle exact matches for character strings
 SET EXCLUSIVE*  Establish shared or exclusive USE of database files
 SET FILTER      Hide records not meeting a condition
 SET FIXED       Toggle fixing of the number of decimal digits displayed
 SET FORMAT*     Activate a format when READ is executed
 SET FUNCTION    Assign a character string to a function key
 SET INDEX       Open one or more order bags in the current work area
 SET INTENSITY   Toggle enhanced display of GETs and PROMPTs
 SET KEY         Assign a procedure invocation to a key
 SET MARGIN      Set the page offset for all printed output
 SET MEMOBLOCK   Change the block size for memo files
 SET MESSAGE     Set the @...PROMPT message line row
 SET OPTIMIZE    Change the setting that optimizes using open orders
 SET ORDER       Select the controlling order
 SET PATH        Specify the CA-Clipper search path for opening files
 SET PRINTER     Toggle echo of output to printer or set the print destination
 SET PROCEDURE*  Compile procedures and functions into the current object file
 SET RELATION    Relate two work areas by a key value or record number
 SET SCOPE       Change the boundaries for scoping keys in controlling order
 SET SCOPEBOTTOM Change bottom boundary for scoping keys in controlling order
 SET SCOPETOP    Change top boundary for scoping keys in controlling order
 SET SCOREBOARD  Toggle the message display from READ or MEMOEDIT()
 SET SOFTSEEK    Toggle relative seeking
 SET TYPEAHEAD   Set the size of the keyboard buffer
 SET UNIQUE*     Toggle inclusion of non-unique keys into an index
 SET WRAP*       Toggle wrapping of the highlight in menus
 SKIP            Move the record pointer to a new position
 SORT            Copy to a database (.dbf) file in sorted order
 STORE*          Assign a value to one or more variables
 SUM             Sum numeric expressions and assign results to variables
 TEXT*           Display a literal block of text
 TOTAL           Summarize records by key value to a database (.dbf) file
 TYPE            Display the contents of a text file
 UNLOCK          Release file/record locks set by the current user
 UPDATE          Update current database file from another database file
 USE             Open an existing database (.dbf) and its associated files
 WAIT*           Suspend program processing until a key is pressed
 ZAP             Remove all records from the current database file

 

>= Greater than or equal

 


 >=
 Greater than or equal--binary                   (Relational)
------------------------------------------------------------------------------
 Syntax

     <exp1> >= <exp2>

 Type

     Character, date, logical, memo, numeric

 Operands

     <exp1> and <exp2> are expressions of any data type to be
     compared.

 Description

     The greater than or equal to operator (>=) is a binary operator that
     compares two values of the same data type and returns true (.T.) if
     <exp1> is greater than or equal to <exp2>.

     .  Character:  The comparison is based on the underlying ASCII
        code.  ASCII codes for alphabetic characters are ascending (e.g., the
        code for "A" is 65 and the code for "Z" is 90).

     .  Date: Dates are compared according to the underlying date
        value.

     .  Logical: True (.T.) is greater than false (.F.).

     .  Memo: Treated the same as character.

     .  Numeric: Compared based on magnitude.

 Examples

     .  These examples illustrate how the greater than or equal
        operator (>=) behaves with different data types:

        // Character
        ? "Z" >= "A"             // Result: .T.

        ? "AZ" >= "A"            // Result: .T.
        ? "A" >= "AZ"            // Result: .F.

        // Date
        ? CTOD("12/12/88") >= ;
           CTOD("12/11/88")      // Result: .T.

        // Logical
        ? .T. >= .F.             // Result: .T.

        // Numeric
        ? 2 >= 1                 // Result: .T.
        ? 1 >= 2                 // Result: .F.
        ? 2 >= 2                 // Result: .T.

See Also: $ < <= <> = (equality) == >

> Greater than

 


 >
 Greater than--binary                            (Relational)
------------------------------------------------------------------------------
 Syntax

     <exp1> > <exp2>

 Type

     Character, date, logical, memo, numeric

 Operands

     <exp1> and <exp2> are expressions of any type to be compared.

 Description

     The greater than (>) operator compares two values of the same data type
     and returns true (.T.) if <exp1> is greater than <exp2>.

     .  Character: The comparison is based on the underlying ASCII
        code.  ASCII codes for alphabetic characters are ascending (e.g., the
        code for "A" is 65 and the code for "Z" is 90).

     .  Date: Dates are compared according to the underlying date
        value.

     .  Logical: True (.T.) is greater than false (.F.).

     .  Memo: Treated the same as character.

     .  Numeric: Compared based on magnitude.

 Examples

     .  These examples illustrate how the greater than operator (>)
        behaves with different data types:

        // Character
        ? "Z" > "A"             // Result: .T.
        ? "AZ" > "A"            // Result: .F.
        ? "A" > "AZ"            // Result: .F.

        // Date

        ? CTOD("12/12/88") > ;
           CTOD("12/11/88")     // Result: .T.

        // Logical
        ? .T. > .F.             // Result: .T.

        // Numeric
        ? 2 > 1                 // Result: .T.
        ? 1 > 2                 // Result: .F.

See Also: $ < <= <> = (equality) == >=

 

== Exactly equal

 


 ==
 Exactly equal--binary                           (Relational)
------------------------------------------------------------------------------
 Syntax

     <exp1> == <exp2>

 Type

     All

 Operands

     <exp1> and <exp2> are expressions of the same data type to be
     compared.

 Description

     The exactly equal operator (==) is a binary operator that compares two
     values of the same data type for exact equality depending on the data
     type.  It returns true (.T.) if <exp1> is equal to <exp2> according to
     the following rules:

     .  Array:  Compares for identity.  If <exp1> and <exp2> are
        variable references to the same array, returns true (.T.); otherwise,
        returns
        false (.F.).

     .  Character:  Comparison is based on the underlying ASCII code.
        ASCII codes for alphabetic characters are ascending (e.g., the code
        for "A" is 65 and the code for "Z" is 90).  Unlike the relational
        equality operator (=) , true (.T.) is returned if <exp1> and <exp2>
        are exactly equal including trailing spaces; otherwise, the
        comparison returns false (.F.).  SET EXACT has no effect.

     .  Date:  Dates are compared according to the underlying date
        value; behaves the same as the relational equality operator (=).

     .  Logical:  True (.T.) is exactly equal to true (.T.), and false
        (.F.) is exactly equal to false (.F.).

     .  Memo:  Treated the same as character.

     .  NIL:  True (.T.) if compared to a NIL value; false (.F.) if
        compared to a value of any other data type.

     .  Numeric:  Compared based on magnitude; behaves the same as the
        relational equality operator (=).

     .  Object: Treated the same as array.

 Examples

     .  These examples illustrate how the == operator behaves with
        different data types:

        // Character
        ? "A" == "A"             // Result: .T.
        ? "Z" == "A"             // Result: .F.
        ? "A" == "A "            // Result: .F.
        ? "AA" == "A"            // Result: .F.

        // Array or object

        aOne := { 1, 2, 3 }
        aTwo := { 1, 2, 3 }
        aThree := aOne
        ? aOne == aTwo           // Result: .F.
        // values within the arrays are equal, but the arrays,
        // themselves, are separate and distinct
        ? aOne == aThree         // Result: .T.

See Also: $ < <= <> = (equality) > >=

= (equality) Equal

= (equality)
 Equal--binary                                   (Relational)
------------------------------------------------------------------------------
 Syntax

     <exp1> = <exp2>

 Type

     Character, date, logical, memo, NIL, numeric

 Operands

     <exp1> and <exp2> are expressions of the same data type to
     compare.

 Description

     The equal operator (= ) compares two values of the same data type and
     returns true (.T.) if <exp1> is equal to <exp2> according to the
     following rules:

     .  Character:  The comparison is based on the underlying ASCII
        code.  ASCII codes for alphabetic characters are ascending (e.g., the
        code for "A" is 65 and the code for "Z" is 90).

        When EXACT is OFF, two character strings are compared according to
        the following rules.  assume two character strings, cLeft and cRight,
        where the expression to test is (cLeft = cRight):

        -  If cRight is null, returns true (.T.).

        -  If LEN(cRight) is greater than LEN(cLeft), returns false
           (.F.).

        -  Compare all characters in cRight with cLeft.  If all
           characters in cRight equal cLeft, returns true (.T.); otherwise,
           returns false (.F.).

        With EXACT ON, two strings must match exactly except for trailing
        blanks.

     .  Date: Dates are compared according to the underlying date
        value.

     .  Logical: True (.T.) is equal to true (.T.) and false (.F.)
        equal to false (.F.).

     .  Memo: Treated the same as character.

     .  NIL: True (.T.) if compared to a NIL value; false (.F.) if
        compared to a value of any other data type.

     .  Numeric: Compared based on magnitude.

 Examples

     .  These examples illustrate how the equal operator (=) behaves
        with different data types:

        // Character
        SET EXACT ON
        ? "123" = "123  "        // Result: .T.
        ? " 123" = "123"         // Result: .F.
        SET EXACT OFF
        ? "123" = "12345"        // Result: .F.
        ? "12345" = "123"        // Result: .T.
        ? "123" = ""             // Result: .T.
        ? "" = "123"             // Result: .F.

        // Date
        ? CTOD("12/12/88") = ;
           CTOD("12/12/88")      // Result: .T.

        // Logical
        ? .T. = .T.              // Result: .T.
        ? .F. = .T.              // Result: .F.

        // NIL
        ? NIL = NIL              // Result: .T.
        ? NIL = 12               // Result: .F.
        ? NIL = CTOD("")         // Result: .F.

        // Numeric
        ? 2 = 1                  // Result: .F.
        ? 1 = 1                  // Result: .T.

See Also: $ < <= <> == > >=

!= # Not equal

 


 <> != #
 Not equal--binary                               (Relational)
------------------------------------------------------------------------------
 Syntax

     <exp1> <> <exp2>
     <exp1> != <exp2>
     <exp1> #  <exp2>

 Type

     Character, date, logical, memo, NIL, numeric

 Operands

     <exp1> and <exp2> are expressions of the same data type or NIL
     to be compared for inequality.

 Description

     The not equal ( <>) operator compares two values of the same data type
     and returns true (.T.) if <exp1> is not equal to <exp2> according to the
     following rules:

     .  Character:  The comparison is based on the underlying ASCII
        code and is the inverse of the equal operator (=).  This means that
        the comparison is sensitive to the current EXACT SETting.  See the
        examples below.

     .  Date:  Dates are compared according to the underlying date
        value.

     .  Logical:  False (.F.) is not equal to true (.T.).

     .  Memo:  Treated the same as character.

     .  NIL:  All values compared to NIL other than NIL return true
        (.T.).

     .  Numeric:  Compared based on magnitude.

 Examples

     .  These examples illustrate how the not equal operator (<>)
        behaves with different data types:

        // Character
        SET EXACT ON
        ? "123" <> "12345"         // Result: .T.
        ? "12345" <> "123"         // Result: .T.
        ? "123" <> ""              // Result: .T.
        ? "" <> "123"              // Result: .T.
        SET EXACT OFF
        ? "123" <> "12345"         // Result: .T.
        ? "12345" <> "123"         // Result: .F.
        ? "123" <> ""              // Result: .F.
        ? "" <> "123"              // Result: .T.

        // Date
        ? CTOD("12/12/88") <> ;
           CTOD("12/12/88")        // Result: .F.

        // Logical
        ? .T. <> .T.               // Result: .F.
        ? .T. <> .F.               // Result: .T.

        // NIL
        ? NIL <> NIL               // Result: .F.
        ? NIL <> 12                // Result: .T.
        ? NIL <> "hello"           // Result: .T.

        // Numeric
        ? 2 <> 1                   // Result: .T.
        ? 1 <> 1                   // Result: .F.

See Also: $ < <= = (equality) == > >=

 

Using code blocks, again

Using code blocks again (.pdf)

The secrets of array handling, part 2.

The secrets of array handling Part – 2