FlashBASIC and BASIC differences

This topic describes the differences between FlashBASIC and BASIC.

Platforms Supported FlashBASIC is supported on AIX, Linux, and Windows.
Mixing FlashBASIC and Interpreted Code If a mainline program is compiled with the o option, all of its subroutines must also have been produced with the FlashBASIC compiler.
AQL FlashBASIC code is never run when called directly from a dictionary definition.
chain statement The FlashBASIC chain statement can be used freely to transfer control to other programs, but variables are not restored if a run statement with the i option is attempted later. This restriction is the same for FlashBASIC applications that are involved in any way with the chain statement.
% calls FlashBASIC currently supports calling C routines, but not assembly routines with the percent call. See the various FlashBASIC % functions.

FlashBASIC code allows a maximum of 62 parameters on an external subroutine call.

rnd() function Calls the host operating system’s random C function.
FlashBASIC Debugger The FlashBASIC debugger does not:
  • Support logical conditions on breaks.
  • Allow any arguments on the g command.
  • Actually do anything when it displays object verifies with the $ command.
  • Allow continuing after an abort.
  • Patch variables in the debugger after a warning message.
  • Allow the use breakpoints when in the break off state.
Arithmetic If using the (f option, all arithmetic operations use the host machines arithmetic.
Parameter Passing FlashBASIC passes parameters by reference, rather than with copy-restore (except for constants and expressions that are passed by copy). This can cause problems in some cases.

For example: If a subroutine is called with the statement call x(y,y(10)) , where y is an array, and within that subroutine y(10) is modified, the current interpreter can restore the value differently than in the compiler.

FlashBASIC allows a maximum of 62 arguments on subroutines.

FlashBASIC does not complain when the number of parameters passed does not equal the number of parameters contained in the subroutine. However, this is not supported and can cause subsequent program failure and data corruption.

Arrays Array bounds checking is absent in FlashBASIC by default, but can be invoked with the b option when compiling. Use this feature with caution, because it can destroy other program data due to application bugs.
Named Commons FlashBASIC and non-FlashBASIC do not share the same named common space.
Named Common variables Named Common variables are not shared between FlashBASIC and BASIC programs run during the same logon session.
Variables In FlashBASIC, variables are assigned a data type at assignment time: string or numeric. If the value assigned to the variable is a non-numeric literal, only the string flag is set. If the value assigned is a numeric literal, both flags are set. If any numeric operation is performed successfully upon the variable, the string flag is set off and the numeric flag is set on.

When two variables are compared, their type flags are checked for compatibility. If both fields have their string flags set, the computer performs a string compare ("001" # "1"). If both fields have their numeric flags set and neither has a string flag set, a numeric compare ("001" = 1) is performed.

It is important to note that this behavior can be controlled by the use of "+0" to normalize numeric variables and force numeric compares; while ":' '" concatenates a space, forcing the numeric flag off and forcing string compares.
Retrieval Lock error messages When running a BASIC program that opens a Q-pointer that points to an md with a retrieval lock, if the user’s key does not match the retrieval lock key:

For BASIC: The system displays the message access protected.

For FlashBASIC: The system displays fn.q is not a file name.
readt statement If a readt is attempted without a device attached, BASIC takes the else clause with system(0) = 1, but FlashBASIC attempts the read.
abort statement If a subroutine encounters an abort statement, processing returns to the calling program.
open statements (Windows Only) For BASIC: The open statement try to open the requested file in the VME.

For FlashBASIC: The open statement will first try to open the requested file in the FSI, then try to open the requested file in the VME.

match statements Invalid match patterns may produce different results between FlashBASIC and BASIC programs.
Assignment Statements Assignment statements in Flash-compiled BASIC programs do not interrogate the values assigned to the variables. As a result, "Variable has not been assigned to value: zero used" messages will not be reported on the same lines as they would have been in a non-Flash-compiled program.
Using pick functions as parameters in % function calls For BASIC: Supported

For FlashBASIC: Not Supported

Shared memory segment Files names greater than 55 characters in length and file and program names with a combined length greater than 62 characters are not uniquely identifiable in a shared memory segment. Additionally, if a program name is not the same in both attribute 0 and attribute 4 of a cataloged subroutine, performance will be degraded.
Number of concatenations allowed in a single statement. The maximum number of concatenations allowed in a single statement when Flash-compiling is 253.
return to statement If the return to statement is used incorrectly in FlashBASIC it will be treated as a return. In non-Flash, it will abort.
User Exits Some user exits may function differently in FlashBASIC vs. non-Flash. For example:

The u8f user exit will produce different results in FlashBASIC and non-Flash.

Using precision in Flash-compiled and non-Flash-compiled programs

  • Flash-compiled programs only perform precision for output purposes. As such, all internal calculations are performed with "infinite" precision, and then formatted to match the precision value for display purposes.
  • Non-Flash-compiled programs recalculate the precision for each mathematical operation.