|
The $MODE directive enables language options for improved compatibility with other multivalue databases.
Format
$MODE option {, option...}
where
option is the feature to be turned on. Multiple comma separated option names may be given.
The available options are:
| DEFAULT | Turn off all options. |
| AUTOLOCK | Automatically locks a record if not already locked on WRITE or DELETE. This is provided for compatibility with some other environments and is not recommended. |
| CASE.SENSITIVE | Enables case sensitivity for names of labels, variables and user defined functions. |
| COMPATIBLE.APPEND | Modifies the behaviour of the append modes of the S<f,v,sv> assignment operator, the INS statement and the INSERT() and REPLACE() functions to match that of other multivalue products. |
| COMPOSITE.READNEXT | Modifies how a READNEXT statement handles exploded select lists. |
| CONDITIONAL.STATEMENTS | Allow most statements that have a THEN/ELSE clause to be used as conditional elements in WHILE or UNTIL. |
| DEBUG.EQUATES | Causes the definition of equate tokens referenced in a program to be saved in the object code when compiling in debug mode so that they can be used in the debugger. |
| DEFAULT.UNASS.ARGS | Enables substitution of a default value for unassigned arguments in a SUBROUTINE or FUNCTION statement. |
| EXCEPTION.SAVE.STACK | Causes the CATCH clause of a TRY/CATCH construct to behave as though the SAVING.STACK option is present. |
| EXECUTE.CLEARLIST | Clears the default select list prior to execution of the command in an EXECUTE statement. |
| EXPLICIT | If enabled, all variables, including scalars, must be explicitly declared in a DIMENSION statement. |
| FOR.STORE.BEFORE.TEST | Stores the new value of the control variable in a FOR/NEXT construct before testing the end condition. |
| HEADING.NO.EJECT | Makes the NO.EJECT mode of the QMBasic HEADING statement the default, suppressing the automatic page throw on setting a new heading. |
| IMPLIED.STOP | The QMBasic compiler normally inserts an implied RETURN at the end of a program, subroutine or function. Setting this option inserts an implied STOP for compatibility with other multivalue products. Class modules always insert a RETURN regardless of the setting of this option. |
| NOCASE.STRINGS | Compiles the program using case insensitive string operations.This directive must appear before any executable statements in the program source and applies to the entire program module. Selecting case insensitive string mode affects the relational operators (=, #, <, >, <=, >=), their multivalue function equivalents (EQS(), NES(), LTS(), GES(), LES(), GES()), the CHANGE(), CONVERT(), COUNT(), DCOUNT(), FIELD(), LAST(), INDEX() and SWAP() functions, the CONVERT, FIND, FINDSTR, GROUPSTORE and LOCATE statements and pattern matching. |
| NO.ECHO.DATA | Suppresses echo of data for INPUT if it is taken from the DATA queue. See also the NO.ECHO.DATA mode of the OPTION command. |
| NON.DURABLE.TXN | Makes transaction commit non-durable such that nested transactions are inherited by the parent on commit. |
| NUMERIC.BOOLEAN | QM support for an internal Boolean data type was added at release 3.2-2 and the @FALSE and @TRUE tokens were modified to use this data type at release 3.3-0. Programs that use @FALSE or @TRUE compiled using release 3.3-0 or later will fail with a run-time error if executed on a release prior to 3.2-2. Use of the NUMERIC.BOOLEAN mode causes @FALSE and @TRUE to evaluate to 0 and 1 respectively for backward compatibility but may cause problems in programs that use data collections on later releases. |
| OPEN.FAIL.ZERO.FVAR | If enabled, sets the file variable in an OPEN, OPENPATH or OPENSEQ to zero instead of unassigned if the open fails. |
| OPTIONAL.FINAL.END | Suppresses the warning message if there is no END statement at the end of the program. |
| PARTIAL.EXPRESSIONS | Causes evaluation of a logical expression to terminate as soon as the result can be determined. See Partial Expression Evaluation for more details. |
| PICK.CONVERT | Pick style argument sequence for CONVERT() |
| PICK.ENTER | Pick style processing of ENTER. |
| PICK.ERRMSG | Pick style syntax for STOP and ABORT. |
| PICK.JUMP.RANGE | Causes the ON GOSUB and ON GOTO statements to continue at the next statement if the index value is out of range. |
| PICK.MATRIX | Create Pick style matrices. See the COMMON and DIMENSION statements for a discussion of the implications of this mode. |
| PICK.READ | Causes READ, READL, READU, READV, READVU and READVL statements to take on the Pick style behaviour in which the target variable is left unchanged if the record is not found. |
| PICK.READNEXT | Causes the READNEXT statement to leave the record id variable unchanged when taking the ELSE clause. |
| PICK.SELECT | Changes the behaviour of SELECTV (and SELECT when $MODE SELECTV is in effect) such that, if the default select list is active, that list is transferred into the target variable instead of building a new list. |
| PICK.SUBSTR | Causes substring assignment operations to take on the Pick style behaviour in which the variable is extended by adding trailing spaces if the region to be overwritten is beyond the end of the current string value. |
| PICK.SUBSTR.ASSIGN | Causes substring assignment operations to take on the full Pick style behaviour as described under Assignment Statements. Setting this mode overrides the PICK.SUBSTR mode. |
| PRCLOSE.DEFAULT.0 | PRINTER CLOSE defaults to printer 0 rather than closing all printers. |
| STDFIL.SHARED | Enables use of the shared default file variable. |
| STRICT.EQUATE | Applies strict rules to EQUATE token names and $DEFINE tokens, reporting a warning if the token name clashes with a reserved name, statement name or intrinsic function name. |
| STRING.LOCATE | Numeric data in right aligned LOCATE is not treated as a special case. |
| SYMTAB0 | Causes the compiler to emit the symbol table in the format used prior to release 4.0-0. |
| TIME.MS | Causes the TIME() function and SYSTEM() with key 12 (SYS$TIME) to return the local time with a fractional (mS) part. This mode applies to the whole program regardless of where it appears. |
| TRAP.UNUSED | Displays a warning about variables that are assigned a value but never used. |
| TRAP.UNUSED.MAIN | Like TRAP.UNUSED but warns only if the variable is assigned a value in the main body of the program rather than in an include record. |
| UNASSIGNED.COMMON | Variables in common blocks are created unassigned instead of being initialised to zero. |
| UV.LOCATE | UniVerse Ideal / Reality flavour style LOCATE. |
Prefixing a mode name (other than DEFAULT) with a minus sign turns off the named option.
The $MODE directive allows use of shortcut names to enable multiple modes in a single step. Other modes that were already set when these are used will not be cleared. The shortcuts that give closest compatibility when migrating an application to QM are described under "Migrating to QM". The shortcut names below are retained from QM version 3.4-17 and earlier.
| D3 | Sets CASE.SENSITIVE, CHANGE.NO.OVERLAP, COMPATIBLE.APPEND, COUNT.OVERLAP, FOR.STORE.BEFORE.TEST, HEADING.NO.EJECT, IMPLIED.STOP, INDEX.OVERLAP, OPTIONAL.FINAL.END, PICK.ENTER, PICK.ERRMSG, PICK.JUMP.RANGE, PICK.MATRIX, PICK.READ, PICK.SELECT, PICK.SUBSTR, PICK.SUBSTR.ASSIGN, SELECTV, SSELECTV, STDFIL, UNASSIGNED.COMMON, UV.LOCATE |
| MVBASE | Sets CASE.SENSITIVE, CHANGE.NO.OVERLAP, COMPATIBLE.APPEND, COUNT.OVERLAP, FOR.STORE.BEFORE.TEST, HEADING.NO.EJECT, IMPLIED.STOP, INDEX.OVERLAP, OPTIONAL.FINAL.END, PICK.ENTER, PICK.ERRMSG, PICK.JUMP.RANGE, PICK.MATRIX, PICK.READ, PICK.SELECT, PICK.SUBSTR, PICK.SUBSTR.ASSIGN, SELECTV, SSELECTV, STDFIL, UNASSIGNED.COMMON, UV.LOCATE |
The modes set by these shortcuts may change between releases.
Default modes can be set by creating a record named $BASIC.OPTIONS in the source file or in the VOC. Details of how to do this can be found with the description of the BASIC command.
Some of these modes can also be used in dictionary I-type expressions.
Examples
$MODE TRAP.UNUSED
FUNCTION INV.CLI(INV.REC)
CLEINT.NO = INV.REC<4>
IF CLIENT.NO = '' THEN CLIENT.NO = INV.REC<18>
RETURN CLIENT.NO
END
The above program contains a typographical error in the spelling of the first use of CLIENT.NO. Because it has been compiled with the TRAP.UNUSED option, the compiler will display a warning message that the CLEINT.NO variable is assigned but never used.
PROGRAM INVOICE
FOR I = 1 TO 3
NEXT I
DISPLAY "I on exit = " : I
END
The above program displays the loop exit value as being 3 whereas the program below uses the FOR.STORE.BEFORE.TEST mode and displays the loop exit value as being 4.
$MODE FOR.STORE.BEFORE.TEST
PROGRAM INVOICE
FOR I = 1 TO 3
NEXT I
DISPLAY "I on exit = " : I
END
See also:
OPTION
|