Miscellaneous Language Changes for BBj
General Language Enhancements
-
BBj can directly execute PRO/5 tokenized programs, BBj tokenized programs, or ASCII text programs
-
Line numbers are optional (but are still fully supported)
-
BBj provides access to BBj custom objects on the server and Java objects on the client or the server
-
The BBj GUI subsystem implements the syntax and features of Visual PRO/5, but is not restricted to Windows; it is available on all platforms, including Linux and macOS
-
Program identifiers (variable names and labels), as well as user-defined function names, are effectively unlimited in length, increased from a maximum 32 characters in PRO/5
-
String arguments in mnemonics are not limited to 250 bytes
-
Substrings are legal on any string expression, for example: FID(1)(1,1)
-
Multi-line IF..THEN statements are allowed (but must be terminated with FI or ENDIF)
-
The C-ISAM file format is not supported
-
The -d command line option causes BBj to bring up the BASIS IDE console window. If the -d option is not specified, BBj will bring up a SYSWINDOW that has console functionality
-
The BBj SQL.INI file format in BBj is different from the format used in PRO/5 and Visual PRO/5. See SQL.INI File Format for more information.
Program Pinning
When BBj encounters the command CALLfilename, it executes an algorithm to find and load the correct program file. BBj traverses the disks and directories defined by PREFIX and DSKSYN statements in the current configuration. After finding the correct file, BBj checks the program cache to determine whether the program file is already in memory. If the file is in memory, BBj then examines the file on disk to determine whether it has been modified since the file in memory was loaded. In most cases, and especially if the PREFIX list is long, BBj is required to make a number of calls to the filesystem.
This algorithm ensures that the next time the command CALLfilename with the same filename is encountered:
-
BBj will reload the modified file if some other process has modified the filename
-
BBj will load a new file if another process has created a new file with the filename that appears 'earlier' in the PREFIX/DSKSYN search path
If BBjServices is configured to pin previously loaded programs, the standard search algorithm will not be executed. Instead, BBj will continue to use the same file each time it encounters CALLfilename, unless the process has executed CHDIR or SETDRIVE. If either CHDIR or SETDRIVE has been executed, then BBj will re-do the standard search algorithm the next time it encounters CALLfilename.
It is common practice for BBx developers to create a new file on disk or to modify an existing file anticipating that programs will immediately begin to use the new/modified file. If programs are pinned, then they will not use the new/modified file when the file can be obtained from the program cache.
To make all programs load a new/modified file, use the Enterprise Manager if program pinning is enabled. The Environment Tab in the Enterprise Manager contains an "Unpin All Programs" button. This button is only available when 'logged' into BBjServices. Clicking this button causes BBj to execute the standard search algorithm to find the file filename the next time BBj encounters the command CALLfilename. After the program is reloaded, it becomes repinned and the standard search algorithm will not be executed in subsequent CALLs to the same program name.
Memory Requirements
While PRO/5 uses a fixed workspace allocated by the -m parameter or the START verb, BBj uses whatever memory was allocated to the JVM in which it is running. Therefore, the workspace concept is not applicable to BBj.
Numeric Expressions
-
The range for numeric literals is +/-1E+/-999999 with up to 255 digits of precision. This compares to the PRO/5 range of +/-1E+/-64 with 16 digits of precision.
-
The integer variable range is unlimited.
String Templates
-
Repeating fields can immediately follow fixed-length fields
-
User-defined attribute strings are effectively unlimited in length, increased from the PRO/5 limit of 255 bytes
-
The $ character can be used before the dot in templated strings. For example, the following identifies a templated string and the original and new methods for accessing the string fields.
-
Templated string
DIM X$:"C:C(10),N:N(10)"
Original access method (still valid)
X.C$ and X.N
New access method
X$.C$ and X$.N
-
Floating point precision is effectively unlimited for standard BBx numeric values. The effective limits for float and double are 8 and 17 digits, respectively
-
The new A template field type stores the ADJN() function bus format for numeric comparison
-
The new O template field type stores a Binary Large Object
-
The I and U field types allow up to 8 bytes (increased from 6 bytes in PRO/5.) An !ERROR=41 is generated if an integer of n bytes is assigned a value outside the range of (-2^(n*8-1),2^(n*8-1)-1).
-
Field types Y and F can manipulate numbers up to the limit of IEEE doubles (1E+308).
-
List of field types:
-
Field
Description
Bytes
NumericValueRange
C
Simple character string
1...32767
N/A
N
Numeric string
1...32767
Unlimited
I
Signed binary integer
1…8
-9223372036854775808 .. 9223372036854775807
U
Unsigned binary integer
1…8
0 .. 18446744073709551615
F
IEEE double-precision binary floating point
8
+/- 5E-325 .. +/- 1.7976931348623157E+308
D
BCD floating point value
8
+/- 9.9999999999999E-64 .. +/- 9.9999999999999E+62
B
Business floating point
8
+/- 9.999999999999999E+/-64)
X
IEEE single-precision binary floating point
4
1.4E-45 .. 3.4028235e+38
Y
IEEE double-precision binary floating point
8
+/- 5E-325 .. +/- 1.7976931348623157E+308
A
ADJN() Function Bus format
8
+/- 9.999999999999999E+/-64
-
Arrays
-
In BBj, multi-dimensional arrays allow an unlimited number of dimensions. In PRO/5, multi-dimensional arrays are limited to 3 dimensions.
-
Numeric arrays can be initialized using syntax equivalent to that used to initialize string arrays. All initialized items in the array are assigned the value of the numericExpression in parentheses. The following syntax is used:
DIM numericVar[numExprList](numericExpression)
-
For example, DIM A[10](1) initializes all values to 1
-
The [] token is equivalent to [ALL] when referring to an array as a complete unit
Serial Device Aliases
In BBj, serial devices are only supported on Linux and Windows ports and must be aliased in the config.bbx file. The first character for the aliased device must start with a "C", and the list of modes is as follows:
baud=integer, mode=5|6|7|8 + E|O|N|M+ 1|2 dsr | -dsr, cts | -cts, xon | -xon, xoff | -xoff, xon/xoff | -xon/xoff
Example:
ALIAS C1 COM1 "comport 1" BAUD=9600,MODE=8N1,XON/XOFF