|Powered by QM on a Linux server|
KnowledgeBase 00115: QMBasic OPEN mode qualifiers
The QMBasic OPEN and OPENPATH statements support some useful mode qualifiers that can be inserted between the filename and the TO keyword.
The ENCODING qualifier, applicable to directory files only, applies a character encoding such as UTF-8.
OPEN 'TEXTFILE' ENCODING 'UTF8' TO TXT.FAlthough this is of most use with the ECS (Extended Character Set) version of QM, it is available in the non-ECS version too.
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
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
This option disables updates to the file.
OPEN 'IMPORT' READONLY TO IMP.FAny attempt to write or delete a record will fail with a run time error.
The SYNC option causes all write and delete operations to be flushed to disk immediately.
OPEN 'AUDIT' SYNC TO AUD.FThis 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:
Codes supplied in value 1 of fields 6 or 7 apply to the data file. Codes supplied in value 2 apply to the dictionary.