logo
Powered by QM on a Rpi server
Home
About OpenQM
Sales and Downloads
Help and Support
About
Login

KnowledgeBase 00082: Setting QMBasic Compiler Options

Last updated: 22 Jul 2016
Applies to: All versions
Search  
Top level index       Full Index Search Tips
Previous article     Next article

This article was originally published as a Tip of the Week.

Introduction

In its default form, QM follows the general concepts of the "Information style" products initially defined by Prime Information and subsequently adopted by PI/open and, to some extent, UniVerse/Unidata in their default modes.

This article summarises some of the features available to improve compatibility with other multivalue products.


$MODE

The $MODE compiler directive enables various language features. Most of these can, if the developer wishes, be enabled for just part of a program module but it is more usual to apply mode settings over the entire program.

See the QM Reference Manual for full details of the mode settings. Some of the more important ones are:

$MODE CASE.SENSITIVEEnables case sensitivity in names for labels, variables and user defined functions.
$MODE IMPLIED.STOPChanges the implied RETURN at the end of a program module to be STOP.
$MODE OPTIONAL.FINAL.ENDMakes the final END at the end of a program module optional.
$MODE PICK.ERRMSGMakes STOP and ABORT work as in Pick style systems, referencing the ERRMSG file.
$MODE PICK.MATRIXChanges from dynamically allocated dimensioned matrices with a zero element to statically allocated matrices with no zero element.
$MODE UV.LOCATEChanges from the slightly illogical Information style definition of the IN clause of LOCATE to the semantics used by UV (and others).

$NOCASE.STRINGS

This compiler directive makes string comparisons case insensitive. Unlike $MODE which can appear anywhere in a program, affecting compilation from that point forwards, $NOCASE.STRINGS must appear before the first executable statement and applies to the entire program.


The $BASIC.OPTIONS Record

Although the compiler directives described above could be inserted separately into each program module, QM provides an easy way to define the modes just once in a record named $BASIC.OPTIONS.

If there is a $BASIC.OPTIONS record in the file holding the program source, this record applies to all programs in that file.

If there is no $BASIC.OPTIONS record in the program source file but there is one in the VOC file, this is used to set compiler options.

In either case, use of

   $MODE DEFAULT 
in the program source code will revert to the default option settings of the compiler.

The $BASIC.OPTIONS record has an X in field 1 to comply with VOC record formats. The remaining fields contain various options to control the behaviour of the compiler. The more important ones are:

CATALOGUEAutomatically catalogue the program on successful compilation. Qualifiers are available to set the cataloguing mode.
DEBUGGINGCompile the program in debug mode.
DEFINE token valueDefine a token similarly to use of $DEFINE or EQUATE in the program source text.
MODE nameEquivalent to use of $MODE in the program source text.
NOCASE.STRINGSEnabled case insensitive string operations.
WARNINGS.AS.ERRORSTreat compiler warnings as errors.


Related Articles

None.



Please tell us if this article was helpful
Very     Slightly     Not at all
Comments
Email (optional)