BBj Changes from Earlier Versions of BASIS Products
BBj represents a complete reorganization and redesign of the PRO/5 language and development tools, taking advantage of the multi-platform and Intranet capabilities of the Java language. BASIS's most important goal is to preserve backward compatibility with existing code, while at the same time offering a host of new features to create distributed, multi-tiered applications running in a Web browser that are ready for new ways of doing 21st century business.
BBj provides UNIX, Linux, and macOS developers with the same graphical user interface (GUI) capabilities that were previously available only in Windows with Visual PRO/5. Both character-based and GUI applications can be run as thin clients and over an intranet. New BBj components, such as the Enterprise Manager and the BASIS IDE (Integrated Development Environment), make it easier to manage the complexity of large development projects. BBj also provides access to external Java objects with the "new" operator and the ability to work with the object's properties and methods, which lets Business BASIC developers tap into the huge body of Java code.
Due to the fact that Java does not distinguish between a carriage return ($0D$) and a line feed ($0A$) by providing a separate KeyEvent for ^J, ^M and ENTER, the BBj SysConsole/SysWindow places $0D$ (for a carriage return) in the input buffer for all of these, rather than $0A$ (for a line feed). When $0D$ is received by the SysConsole/SysWindow, the usual behavior is to move the cursor to the start of a new line.
For additional information on BBj Function Keys, see Function and Edit Keys for BBj Character Devices. The following list is a sampling of differences and should not be considered complete or exhaustive.
NEW ENVIRONMENTS AND COMPONENTS
The two environments available in the PRO/5 family are PRO/5 for UNIX and Visual PRO/5 for Windows. The BBj equivalent for PRO/5 is called the TermConsole, a purely character-based environment that relies on termcap and is the choice for non-graphics capable hardware such as terminals. The Visual PRO/5 SysWindow has multiple counterparts in BBj. The BBj SysConsole (so named because it allows command line input and code development) works just like the Visual PRO/5 SysWindow. The BBj SysWindow is a new component that behaves like the old SysWindow. It is an output screen where the application runs, but does not allow command line input or code development. It displays output and takes input from read/input/readrecord statements or inpute/inputn fields, but does not provide a command line or ">" prompt or allow code development. The BASIS IDE and the BBj WinConsole are new code development environments. Both provide editing and debugging capabilities that far surpass what is available in the SysConsole. The BASIS IDE allows multiple source files to be open at the same time.
GUI COMPONENTS
The BBj GUI subsystem is based on the syntax and features of Visual PRO/5, but is now portable between UNIX/Linux, macOS, and Windows. The appearance of visual controls and components is based on the Java "Look-and-Feel" (Motif, Windows, Metal, Mac Aqua) supported by the platform. This means that BBj applications running on Microsoft Windows will appear as they did in Visual PRO/5, while the same application running on a Macintosh will take on the appearance and characteristics of Mac Aqua.
BBj GRID ENHANCEMENTS
Enhancements have been made to grid cell editing, and toggling check box and button style cells. These changes have been made to make programming the grid easier and to more closely match other mainstream languages. These changes are now the default and may cause some undesired effects on programs written for Visual PRO/5. Programs can be made to use backward-compatible grid behavior by setting SETOPTS bit 8($10$). This will make all grids in the program behave like the Visual PRO/5 grid. Set the SETOPTS bit in the config file or add the following line to the beginning of the program:
LET OPTS$=OPTS; LET OPTS$(8,1)=IOR(OPTS$(8,1),$10$); SETOPTS OPTS$
New SENDMSG() functions have been added for managing grids, and functionality has changed in many areas. See Grid Controls for complete information.
In BBj, the grid stores the cell data internally, and it is no longer necessary to continually respond to Table Update notify events and redisplay cells. See Table Update - GRID Notify Event 22 for additional information.
Standard and data-aware grids can be set up to enter edit mode automatically when a mouse click or double-click occurs on a cell.
New Grid SENDMSG() Functions 106 and 107 can be used to control which columns or individual cells in which editing will be allowed.
In Visual PRO/5, masks are applied to data only while the cell is in edit mode. In BBj, masks are applied to displayed cells that are not in edit mode. See Set Up Grid - GRID SENDMSG() Function 30 for additional information.
Visual PRO/5 generally treats the main grid, column header and row header grids as three separate controls. In BBj, the grid and its headers are always handled as one unit.
GRID CELL EDITING
The grid will, by default, automatically handle editing without requiring programs to use the Start Edit - GRID SENDMSG() Function 31. With this option, the grid cell will be edited when it is double-clicked, if the cell has not been set as uneditable using SENDMSGS() 106,107, 108 or 81 with option $01$ for data-aware grids. If the automatic editing option is used, the Start Edit and End Edit SENDMSGs will be ignored.
By default, grid editing will begin in response to a double-click. The number of clicks needed to start editing can be changed using SENDMSG 111, Set Edit Click Count. The start edit and edit kill notify event will still be generated when editing starts and ends, respectively on a cell.
CHECK BOX AND BUTTON STYLE CELLS
Grid cells that have
been given Check Box or Button styles 1, 2, 4 or 8 will, by default, behave
differently in BBj than in Visual PRO/5. When these cells are selected,
the state of the button or checkbox will toggle automatically. If the
check box is unchecked, and the user clicks on it, then the grid will
automatically set the check box to checked. In PRO/5, the program listened
for the mouse click notify event and then set the style of the cell when
the user clicked on it.
Toggling of the check box and button style cells can be turned off in two
ways. The first is to set the SETOPTS bit (8,$10$) for Backward Compatible
Grid behavior. The second is to use either SENDMSG 106, 107 or 108 to
make the cell non-editable, meaning the user will not set the state of
the cell. The LCLICKED event will still be sent so that the style of the
cell can be changed programmatically in response to a mouse click.
LANGUAGE KEYWORDS
BBj now enforces reserved keywords, which promotes cleaner, more legible source code and better programming practice. See BBj Reserved Keywords for a complete listing of these reserved keywords.
LINE NUMBERS AND CODE FORMATS
BBj code does not require line numbers. Existing code containing line numbers is still supported, and new code containing line numbers can be written in BBj. BBj will run programs in PRO/5 token format, BBj token format or ASCII text.
REM must be followed by one or more spaces in BBj.
NUMERIC RANGE
The supported numeric range of BBj is +/-1E+/-999999 with up to 255 digits of precision. This PRO/5 range is +/-1E+/-64 with 16 digits of precision.
PROGRAM IDENTIFIERS
Variable names and labels are effectively unlimited in length, increased from a maximum 32 characters in PRO/5. Since BBj 13.0, BBj variable names can also begin with an underscore.
TEMPLATE AND STRING ENHANCEMENTS
New template field type A stores ADJN() format; limit for field types I and U increased from 6 to 8 bytes; field names and user-defined attributes are now unlimited in length. Field types Y and F can now manipulate numbers up to the limit of IEEE doubles (approximately 1E+308).
String arguments in mnemonics are no longer limited to 250 bytes.
Substrings are legal on any string expression, for example: FID(1)(1,1).
GUI CONTROLS
BBj implements many controls that are not available in Visual PRO/5, including trees, spinners, navigators, charts, font choosers, color choosers, file choosers, date input, and menu buttons.
SERIAL DEVICE ALIASES
In BBj 7.0 and higher, only Linux and Windows ports support serial devices without an installed extension to Java. Other platforms require the Java Communications API extension to use serial devices. Refer to the Java-provider documentation for information on installing the Java Communications API. In order to use serial devices, aliases for these devices must appear in the config.bbx file.
On AIX, the following three steps provide serial device support:
-
Install the Java Communications API.
-
Download Java5.ext.tar.gz (Comm API and Java 3D) from IBM's AIX Developer Kit and Runtime, Java Technology Edition.
-
Install the package with smit or smitty system management tools or the installp command. This installs several extensions however the following extension is required:
Java14.ext.commapi 1.4.2.0 # Java SDK 32-bit Comm API Ext...
Note: Installing the Java extensions on AIX requires an installed Java SDK.
-
-
Create the serial devices.
-
Name all serial devices according to the specific naming convention the AIX Java Communications API requires. The following is from the AIX Java Communications API documentation.
----------
The API is shipped in the Java5.ext.commapi fileset (optionally installable) and supports an unlimited number of tty's, with ttyn mapped to COM(n+1) where n is 0 or a positive decimal integer:
/dev/tty0 -> COM1
/dev/tty1 -> COM2
...
/dev/tty9 -> COM10
/dev/tty10 -> COM11
...
If a tty is not available, the corresponding COM port is not available. For example, if tty0 and tty2 are available but tty1 is not, COM1 and COM3 can be available but COM2 is not.
---------- -
Verify all the used serial ports conform to the naming standard /dev/ttyn and that there are no links since the Java extension expects these devices to be real devices.
-
-
Create entries for serial devices in config.bbx.
-
Reference the device in the AIX Java Communications API by its name (COM1, COM2, etc.), not by the system device (/dev/tty0, /dev/tty1, etc).
For example, to access /dev/tty0(COM1) with a baud rate of 19200, add the following alias to config.bbx:
ALIASC1COM1"commport1"BAUD=19200,MODE=8N1,XON/XOFF
-
In the BBj code, use the following to open, write, and read the serial device:
READY> open(1) "C1"
READY> write(1) "Hello"
READY> read(1) a$
-
Note: The AIX Java Communications API does not recognize /dev/ttyn as a serial device. Therefore, since the device cannot be opened explicitly, open it through the alias using the three steps outlines above.
UTILITIES
The _label utility works by manipulating low-level PRO/5 program formats. It does not work with BBj program files.
ENHANCEMENTS TO VERBS AND FUNCTIONS
Please see Language Changes for more specific information about the enhancements and modifications to verbs and functions in BBj. The following listing is a sample of some of these changes.
-
DATE() derives day and month names from Java's internal (internationalized) values, not from STBL("!DATE"). New DATE() keys "%W" returns day number within the week and "%J" returns day number within the year.
-
DIM N[10](1) initializes a numeric array elements. DIM for arrays now allows more than 3 dimensions, and the DIMS() function returns information about extra dimensions if used.
-
ENV() returns operating system environment variables.
-
ERRMES(-1) returns the last error message. BBj error messages are more precise (specific to the actual cause of a problem) than in PRO/5.
-
FBIN() and FDEC() allow for the full range for IEEE doubles (+/-1E+308).
-
IF..THEN..ELSE supports an optional multi-line syntax:
IF
X=1 THEN
PRINT
"ONE"
ELSE
PRINT
"NOT ONE"
ENDIF
-
MASK() supports most of the masking features from Perl 5.
-
MKDIR and RMDIR verbs allow multiple directories, separated by commas.
-
PRECISION allows up to 255 digits; an optional second argument specifies when to display numbers using floating point format instead of standard format. The ROUND() function also allows up to 255 digits, and TCB(14) can return any value from -1 through 255.
-
PUB() substring (4,4) returns full program size as a binary value.
-
When the PGM() function is used to query a specific program line, the listed version of the line is returned; in PRO/5, the tokenized version of the line is returned.
-
TCB(3) returns 0 if the program has line numbers or 1 if line numbers are not used. This is compatible with PRO/5, which always returns 0 for TCB(3). If the program does not use line numbers, TCB(4) through TCB(8) return the ordinal line number within the source program.
-
WAIT supports fractional seconds.
-
XKEYED files are similar to MKEYED files, but with no limits on key size, key segments, or record size
-
VKEYED files are similar to XKEYED files, but with variable-length records, named keychains, and the ability to dynamically add or drop keychains.
NEW STANDALONE PROGRAMS
To run BBJCPL (the replacement for PRO5CPL) enter the following:
<install location>/bin/BBjCpl
To run BBJLST (the replacement for PRO5LST) enter the following:
<install location>/bin/BBjLst
To run the BBj SysConsole (the replacement for the Visual PRO/5 SysWindow) enter the following:
<install location>/bin/BBj
To run the BBj WinConsole (an improved debugging environment) enter the following:
<install location>/bin/BBj -d
To run the BASIS IDE (the Integrated Development Environment) enter the following:
<install location>/bin/BasisIDE
To run the BBj TermConsole (the replacement for PRO/5 on non-graphics capable systems) enter the following in a shell or terminal emulator:
<install location>/bin/BBj -t<terminal alias from config.bbx>
The default behavior for programs run in the BBj SysConsole is for them to drop to a > prompt when they encounter an ESCAPE or an untrapped error. Programs invoked with the -d (debug) option will drop to a WinConsole window, which allows more debugging. The WinConsole looks like the individual program windows in the BASIS IDE. The WinConsole contains a program editor, history tab, watch tab and command line field. The WinConsole mode is useful for debugging in the field when a BASIS IDE might not be available.
BBj uses ASCII resource files (.arc) instead of binary resource files (.brc). See Converting Resource File Formats for instructions on how to convert one or more binary resource files automatically into ASCII resource files using ResBuilder's command line parameters.