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

KnowledgeBase 00115: QMBasic OPEN mode qualifiers

Last updated: 17 Feb 2017
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.

The QMBasic OPEN and OPENPATH statements support some useful mode qualifiers that can be inserted between the filename and the TO keyword.


ENCODING

The ENCODING qualifier, applicable to directory files only, applies a character encoding such as UTF-8.

   OPEN 'TEXTFILE' ENCODING 'UTF8' TO TXT.F 
Although this is of most use with the ECS (Extended Character Set) version of QM, it is available in the non-ECS version too.


NON.TRANSACTIONAL

Use of this option causes updates applied to the file within a transaction to be applied immediately rather than at transaction commit.

   OPEN 'LOG' NON.TRANSACTIONAL TO LOG.F 


NO.MAP

This option, applicable to directory files only, suppresses the normal translation of reserved characters in record ids, allowing access to items that might otherwise conflict with QM record id rules.

   OPEN 'IMPORT' NO.MAP TO IMP.F 


READONLY

This option disables updates to the file.

   OPEN 'IMPORT' READONLY TO IMP.F 
Any attempt to write or delete a record will fail with a run time error.


SYNC

The SYNC option causes all write and delete operations to be flushed to disk immediately.

   OPEN 'AUDIT' SYNC TO AUD.F 
This is useful in logging files but will have a serious impact on performance if used too widely.


VOC Open Mode Flags

The open mode qualifiers described above can also be set using options in the VOC F-type record defining a file.

The encoding name can be supplied in field 7 of the VOC item. If this is present and the ENCODING option to OPEN is also used, the encoding specified in the OPEN overrides the VOC entry. Use of "NULL" as the encoding name in the OPEN will open the file with no encoding.

The other open modes described above can all be specified by including any meaningful combination of the following single letter codes in field 6 of the VOC entry:

NNon-transactional.
RRead only.
SSynchronous (forced write) mode.
TSuppress id translation.

Codes supplied in value 1 of fields 6 or 7 apply to the data file. Codes supplied in value 2 apply to the dictionary.


Related Articles

None.



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