ASFLAG

Updated March 2015; see History

xcall ASFLAG, flag

ASFLAG.SBR allows a program to set various internal A-Shell options that do not fall conveniently under another category.

Parameters

flag  (Num)  [in]

One or more flags to set from the following table. Note that if flag is mapped as B,2 (or B,4, see History note below), then the previous flag settings will be returned in the variable; this is useful when you want to temporarily change the flags and then restore them.

Symbol

Value

Meaning

 

 

Same as 1 if omitted (i.e. xcall ASFLAG equals xcall ASFLAG,1)

 

&h00000

Turn off all flags

AF_READONLY

&h00000001

Turn on Read Only

AF_SYNCWRITE

&h00000002

Turn on Synchronized Write mode for D-ISAM

AF_DIVIDEBY0

&h00000004

Allow divide by zero. Treats a division by zero as equal to zero, rather than generating a BASIC error. This is the runtime equivalent of the BASIC Plus compile-time source directives DIVIDE’BY’0 and NO’DIVIDE’BY’0.

AF_EXITSBX

&h00000008

Force exit to dot from SBX.

AF_MMAP

&h00000010

Memory Mapping

AF_NOIDXLOK

&h00000020

No IDX Lock

AF_LOCALCOPY

&h00000040

Make Local Copy of file (Windows only)

AF_SETCTRLC

&h00000080

May be used within an SBX subroutine to force a Force Ctrl+C to Parent program (on return from the SBX)

AF_NOMMAP

&h00000100

Turn off memory mapping (overriding the MMAPLIST setting in miame.ini) for any files subsequently opened in the current program.

AF_CRYPT

&h00000200

Encrypt on allocate, disam create. Only applies to versions of A-Shell which support the Encrypted File System (EFS). Contact MicroSabio for more info.

AF_NOCRYPT

&h00000400

Override m1.crypt flags. Only applies to versions of A-Shell which support the Encrypted File System (EFS). Contact MicroSabio for more info."

AF_CSVNOQUOTE

&h00000800

Disables all special handling of double-quote characters (ASCII 34, or "), treating them as ordinary data characters.

AF_CSVSMARTQUOTE

&h00001000

Obsolete as of A-Shell 5.1.1163 of October 09. In prior versions: Enables "smart" handling of double-quote characters. A-Shell looks at the context of the line to guess whether a double-quote character is being used to enclose a field (that may contain special characters, including line breaks), or it is simply an ordinary data character.

AF_ISAMNODUPERRS

&h00008000

Modifies the behavior of the ISAM-A CREATE'RECORD statement. Normally, if the record already exists (and duplicates not allowed), it returns BASIC error 208 (attempt to add duplicate key). With the AF_ISAMNODUPERRS flag set, CREATE'RECORD will instead just return FSTAT=2 but no BASIC error. The motivation is mainly to improve performance of certain specialized file build operations where you want to add a record if it doesn't exist but do nothing if the record does exist. Setting the flag allows the program to eliminate a FIND operation prior to each CREATE'RECORD, which may significantly increase the build speed.

AF_SBXASRUN

&h00010000

Set SBX as Run.

Definition file: ashell.def

 

Comments

•   This subroutine was first introduced as SETRO since its only function was the "Set Read Only" mode. ASFLAG is backward compatible with SETRO, so you can either change the name in your source code or alias it in miame.ini (e.g. ALIAS=SETRO:ASFLAG).

•   A technique related to the memory mapping and local file schemes described above for speeding up single-user or read-only access to a file is that of loading a file into user memory (with LOAD.LIT or MX_USRLOD) and then accessing it via the MEM: device.

•   If the flag parameter is mapped as B,2 then the previous flag settings will be returned in the variable. This is useful when you want to temporarily change the flags and then restore them.

•   All flags are reset at the start of each RUN program. Otherwise, unless modified by a subsequent ASFLAG operation, they remain set for the duration of the current program.

•   The ASFLAGs are not cleared at the start of SBXs. Thus changes during the execution of a RUN or SBX will be passed down to lower level subroutines, but they do not percolate back up.

History

2015 March, A-Shell 6.1.1405:  Previously, the ASFLAG options were cleared at the start of each SBX. They are now passed from the current program (parent) to the SBX (child). As before, flags set within the SBX do not affect the caller, except for AF_EXITSBX and AF_SETCTRLC.

2012 October, A-Shell 6.1.1319:  ASFLAG now supports both B,2 and B,4 for the flags argument, returning the current flags in either case. Also add flags AF_ISAMNODUPERRS and AF_SBXASRUN.