SETOPTS string


For BBj-specific information, see the SETOPTS Verb - BBj.

The SETOPTS verb places PRO/5 into nonstandard modes of operation. PRO/5 keeps a string called the "options vector" internally. Different bytes and bits within the options vector may be set to enable various optional modes. The current value of the options vector may be accessed with the OPTS variable. The length of the options vector is initially implemented as 16 bytes. Future releases of PRO/5 may expand, but not shorten, this length. SETOPTS is not shared between tasks and is not affected by BEGIN, RESET, CLEAR, or START. The string argument for SETOPTS may be any length that does not exceed the size of the options vector. If string is shorter than the options vector, the remaining bytes in the options vector are unchanged. The following bits (in hexadecimal format) are currently recognized:



1 $80$

Causes an !ERROR=63 to be issued if a variable is referenced that has not been explicitly assigned a value. Because PRO/5 provides both long variable names and default values, a variable may be misspelled. This bit is intended for development and testing, and is not intended for programs that depend on default values.

1 $40$

Turns off all error traps and can be used when debugging an application.

1 $20$

Places the character-based EDIT window and character-based INPUTE fields in insert mode. When insert mode is toggled with CTL-T in the EDIT window or INPUTE, this bit is also toggled.

1 $10$

Disables the "pause" feature of LIST and DUMP.

1 $08$

Enables console mode and debugging in public programs and may also enable other language features. If $08$ is not set, entering console mode from a public program results in an error.

1 $04$

Causes PRO/5 to use the old SAVEP algorithm . (For use with PRO/5 versions prior to 2.20)

1 $02$

Displays in lower case all variable names of programs listed with LST() function or LIST command.

1 $01$

Displays in lower case all commands and keywords of programs listed with LST() function or LIST command.

2 $80$

Produces a nondestructive cursor advance when using the @(X) column positioning mnemonic. Normally, when using column positioning to advance the cursor on the current line of a terminal screen, PRO/5 uses spaces, and existing characters are overwritten. Many existing applications rely on this, while others fail, depending on the Business BASIC the application came from.

2 $40$

Causes PRO/5 to output a linefeed on a PRINT statement that has no IOLIST. Linefeeds are typically output only at the end of a field, and simple PRINT statements have no effect. However, some Business BASICs make exceptions for PRINT statements with no IOLIST and older applications may depend on this.

2 $20$

Causes PRO/5 to numerically round intermediate results immediately after multiplication, division, and exponentiation. See the Rounding section in the User's Reference Guide for the PRO/5 rules for rounding. This bit should be used only in older application programs that may be sensitive to rounding methods.

NOTE: This option may slow down numeric computations.

2 $10$

Strips embedded spaces from the string argument to the NUM() function. For example, NUM("1 2 3") normally returns an error because its argument does not meet the rules for numeric constants. Some older Business BASICs allow embedded spaces, however, and bit $10$ should be set for application programs that rely on no embedded spaces.

2 $08$

Allows PRO/5 to ignore mask overflows in PRINT, WRITE, and STR(); otherwise an !ERROR=43 is issued when a numeric value exceeds a format mask. When set, PRO/5 outputs the number without a format.

NOTE: If an ERR=option is present in a STR() function, the error branch is still taken.

2 $04$

Causes PRO/5 to reject WRITEs to a DIRECT or MKEYED file (in single key mode) or to an unextracted record when the WRITE does not specify a key. MKEYED files being used in multikey mode contain the key specification in the data record and a key clause. This bit is for compatibility with other Business BASICs.

2 $02$

Disables math coprocessor use. On machines with math coprocessors, PRO/5 may use the coprocessor to enhance the speed and accuracy of the SIN(), COS(), ATN(), SQR(), and LOG() functions, as well as the exponentiation (^) operator. The exact speed and accuracy depend on the type of coprocessor, so the results of identical computations may not be identical to the very last decimal place on all platforms supporting PRO/5. This bit is for applications that require the results of these functions to be exactly the same on all machines.

2 $01$

Causes PRO/5 to force MS-DOS to update the length of a dynamic file, such as an MKEYED file, after any additions to the file.

NOTE: This slows down MKEYED file writes.

3 $80$

Allows program loading (RUN, LOAD) from the public program space (ADDR). Because a significant amount of the time to perform a normal LOAD or RUN is used by the host operating system, this option substantially reduces the time required to overlay the workspace program.

3 $40$

Allows PRO/5 to use advisory locking in data files. When PRO/5 is using advisory locking, an EXTRACT blocks another EXTRACT or REMOVE, and a READ operation will be allowed to access data extracted by another user. A READ operation also accesses data extracted on another channel by the same user. After enabling this bit on all terminals, test this capability by attempting to read and write a record extracted by another process. Special conditions exist for advisory locking on Novell systems. See the Installation and Configuration Guide for additional information.

NOTE: When advisory locks are specified, an EXTRACT may or may not block a WRITE, depending on operating system rules.

3 $20$

Allows multiple read processes to access the key region of a keyed file, while blocking write processes. With bit $20$, however, a system may have enough read operations that a write operation could not regain exclusive access to the file. This is affected by the type of locks the system uses and the locking technique used by the host operating system. In addition, this feature may not be available and may not improve performance. Special conditions exist for advisory locking on Novell systems. See the Installation and Configuration Guide for additional information.

3 $10$

Provides the capability to WRITE through an EXTRACT when used in conjunction with SETOPTS 3 $40$. This capability is only possible if the operating system supports advisory locking.

3 $08$

Disables the hash check of a program upon loading. PRO/5 uses the hash check to ensure that the program loaded is the same as the one saved. If the program has been corrupted in storage, this bit prohibits detection of the corruption and a later PRO/5 failure. This bit may be set in a production environment where the reliability of the data storage is proven.

3 $04$

Prevents PRO/5 from accessing a file with a nonzero count in the access count stored in the header of the file. This should only be performed in the utility system after a system failure.

3 $02$

Enables the replacement of mask characters in masks printed to output devices, and in data used in the CVS() function when the mask conversion bit is specified in that function. The "," character is replaced with the contents of the options vector byte 5, and "." is replaced with the contents of the options vector byte 6. Failure to set this bit or load values into the opts positions disallows mask character replacement.

3 $01$

This bit is set by PRO/5 while running under MS-DOS on a Novell network. It may be reset by the application.

4 $80$

Limits the search performed when opening a file. Normally, all available disks are tried with all available PREFIX values that do not include disks. This bit forces the PREFIX to be scanned only once, and any entries without a disk specified are scanned with the current disk only.

4 $40$

A Network Lock bit for standard access of files across the network. This bit enables the older, slower file locking scheme and is necessary when accessing files that may also be accessed by a non-PRO/5 task or by a PRO/5 task running on a remote host by any process other than the PRO/5 Data Server.

4 $20$

Allows access to the PRO/5 Data Server software. Activating this capability may cause error reports on systems without a TCP/IP interface or on systems whose interface differs significantly from the porting system. This bit cannot be set if PRO/5 is not prepared to work with a remote PRO/5 Data Server. If this bit is set, INFO(3,1) will return the host IP address in bytes 5 through 8.

4 $10$

Enables systems that support the C-ISAM file type to recognize C-ISAM files.

4 $08$

Forces templates and keys to use 14 digit Business Math precision and is included for compatibility with earlier versions of BASIS products.

4 $04$

Affects the output of the STR() function by switching the way a mask with "#" characters in the trailing positions is filled.

0 = spaces

1 = zeros

For example, the function STR(.10:"#.##") returns the following:

.1 Bit = 0

.10 Bit = 1

4 $02$

Allows PRO/5 to "adjust" the number of leading spaces for lines printed in expanded ('EP') mode.

4 $01$

Alters the way numbers are expressed in "E" notation. Normally, numbers in "E" format begin with a decimal point (".1E+01"). With this bit set, an additional zero is added to the beginning ("0.1E+01"). This affects the operation of the STR() function and the WRITE/PRINT verbs.

5 (all)

This character replaces the numeric mask character "," when permitted by OPTS byte 3, bit $02$, above.

6 (all)

This character replaces the numeric mask character "." when permitted by OPTS byte 3, bit $02$, above.

7 $80$

PRO/5 checks the filesystem to determine if 4GB (PRO/5 Rev. 2.x only) or 64-bit (PRO/5 Rev. 3.x and higher) files are supported. When this bit is set, MKEYED files created on host systems that support 4GB (PRO/5 Rev. 2.x only) or 64- bit (PRO/5 Rev. 3.x and higher) files are automatically created with 4GB or 64-bit capabilities.

Currently, the only Windows operating systems to support 64-bit files are those based on NT (Windows 2000, XP, etc.). 64-bit MKEYED files are not supported on operating systems that are not NT-based, such as Windows 95, 98, or Me. Attempting to open or erase a 64-bit MKEYED file on operating systems that are not NT-based will cause an !ERROR=153 (file system does not support large files). However, access to these 64-bit files through the PRO/5 Data Server is fully supported.

7 $20$

Formats MKEYED files for corruption recovery which allows the files to be easily recovered if corrupted. Performs the same function as the mrebuild utility.

7 $10$

Disables "nag" messages and cause PRO/5 to exit instead of going into nag mode when a PRO/5 license cannot be obtained. If the license that cannot be obtained is for a PRO/5 Data Server, a !ERROR=69 failure will be returned on the connecting OPEN.

7 $08$

Allows Grid controls created in Visual PRO/5 2.0x to be used in 2.10 and higher without having to change the Vertical Lines flag from $0020$ to $8000$.

Prevents the 'RESOURCE' mnemonic from attempting to scale the fonts if the 'SCALE' mnemonic was used to change the scale factors.

Causes the 'RESOURCE' mnemonic to ignore the "Allow col resize" checkbox in the ResBuilder grid control property sheet.

Causes the 'GRID' mnemonic to always allow users to resize the grid columns, even if the User Resize flag ($0008$) is not specified.

Prevents the 'FONT' mnemonic from attempting to scale the fonts if the 'SCALE' mnemonic was used to change the scale factors.

This bit also:

  • Changes the size of some of the controls including EDIT, INPUTE, and INPUTN that were created with the client edge flag such that the edges do not line up with other controls.

  • Slightly changes the dimensions of top-level windows that do not have title bars and causes them to shrink if moved with the 'MOVE' mnemonic.

7 $04$

Causes the SYSGUI device to use the system font as the default font and bases all chars and semicharacters unit conversions on the system font. Primarily for compatibility, it allows programs to run as they did in version 1.05 but changes the way semicharacters and default system fonts are interpreted. It also affects the CVT() and RESINFO() functions that perform unit conversions. This bit cannot be changed while a SYSGUI device is open.

This bit also:

  • Prevents the 'SCALE' mnemonic from affecting the size of resources printed with the 'RESOURCE' mnemonic.

  • Prevents the 'SCALE' mnemonic from affecting the size of the fonts.

  • Suppresses focus change events for check boxes, radio buttons, list boxes, and buttons.

If this bit is not set:

  • An !ERROR=12 is issued when a bitmap used in an image or tool button cannot be found.

  • It allows a list button list, edit, or list box title to be used as the initial entry or entries in a list.

7 $02$

Prevents PRO/5 from closing any SYSGUI channels during the execution of a BEGIN statement.

7 $01$

Setting this bit:

Prevents single-user versions of PRO/5 from generating an !ERROR=0 when attempting to open a file that had been opened on another channel through a different path. The bit allows the "./" search designation to be used for all versions of PRO5. For example, if OPEN(1)"file" is used to open "file", OPEN(2)"./file" could be used to open the same file on a different channel.

Prevents an !ERROR=12 from occurring when an SQLOPEN command is performed on a data source listed in a config.tpm file after the config.tpm has been opened in PRO/5. This applies to single and multiple user versions.

8 $80$

Forces the FID() to report MKEYED files as type $06$. When this bit is set, recoverable and 64-bit MKEYED files are reported as standard MKEYED files. In addition, recreating these file types using the INITFILE verb or the FILE verb in conjunction with the file's FID() will result in standard MKEYED files. This bit is operational in PRO/5 Rev 2.23 and higher and Visual PRO/5 Rev 2.22 and higher.

8 $02$

In PRO/5 6.0, CTL is not affected by reads from data files, only by reads from interactive devices.

9 $80$

In PRO/5 6.30 and higher, and BBj 7.0 and higher, the NUM() function, the INPUT Verb, and the READ Verb reject numbers formatted in scientific notation if the exponent is specified without an explicit '+' or '-' sign. For example, when this SETOPTS bit is set, NUM("12345E+6") is legal, but NUM("12345E6") reports !ERROR=26.

9 $40$

In PRO/5 14.0 and higher, and BBj 15.0 and higher, setting this bit causes assignments to fixed-length template type N fields to be padded out with leading zeroes. For example, DIM X$:"N:N(10)"; LET X.N=42; PRINT X.N$ will print 0000000042.

9 $10$

In PRO/5 15.01 and higher, and BBj 15.10 and higher, the OPEN verb by default is restricted from opening pipes (commands starting with "<", ">", or "|") in console mode.  This is to protect against accidentally overwriting a data file as a side effect of inadvertently specifying a pipe expression.  To open a pipe at console, set this bit or include MODE="PIPE" in the OPEN.

PRO/5 reserves bytes 9 through 10. Bytes 11 through 16 are for application use, and are not used by PRO/5.

Setting Multiple Options

To set multiple options at one byte, first hexadecimally add the values, and apply the IOR() function to the result. For example, to set byte 1, bits $80$, $40$, and $02$ at the same time, IOR() the result of $C2$.

Setting Multiple Bytes Simultaneously

By using hexadecimal arithmetic, multiple bytes can be set at one time by specifying the hexadecimal code for each byte. To see the current options vector in a readable form, print the HTA() of the OPTS variable. The OPTS variable shows the 16 bytes as a string of two-character hex codes.

Turning Off Options

Use the AND() function to turn an option bit off (see example 4 below).


Example 1

The following turns on nondestructive cursor advance, while leaving the rest of the options vector unmodified.

1000 LET A$=OPTS
1010 LET A$(2,1)=IOR(A$(2,1),$80$)

Example 2

The following sets options byte 1, bits $80$, $40$, and $02$ causing PRO/5 to check for unassigned referenced variables, turn off all error traps, and show all variable names in lower case.

1000 LET A$=OPTS
1010 A$(1,1)=IOR(A$(1,1),$C2$)

Example 3

The following illustrates how to manually change byte 2 to turn on bits $80$, $40$, and $02$ and byte 3, bit $02$.

0020 LET A$=$00C20240000000000000000000000000$

Example 4

The following turns off nondestructive cursor advance, while leaving the rest of the options vector unmodified.

1000 LET A$=OPTS
1010 LET A$(2,1)=AND(A$(2,1),$7F$)

See Also

Verbs - Alphabetical Listing


Copyright BASIS International Ltd. BBj®, Visual PRO/5®, PRO/5®, and BBx® are registered trademarks.