Migrating Changed Features [ HP Business BASIC/XL Migration Guide ] MPE/iX 5.0 Documentation
HP Business BASIC/XL Migration Guide
Migrating Changed Features
The features listed below work differently in HP Business BASIC/XL.
Change your use of these features as indicated below to avoid problems in
your applications.
ANYPARM
Actual parameter format is different. The internal representation of the
area used for storing string and array sizes is also different.
The address passed in the actual parameter table is a 4-byte value
aligned on a 4-byte boundary. Type and dimension information for each
parameter is contained in each of two 2-byte fields of the subsequent
4-byte word.
BASIC SAVE Program File
The BASIC SAVE program file format is different because of differences in
the interpreter's internal tables. You cannot use compatibility mode
BASIC SAVE files in the native mode interpreter and compiler. Convert
compatibility mode BASIC SAVE (BSAVE) files to native mode BASIC SAVE
(BSVXL) file. See chapter 4, "Migrating Business BASIC/V Files," for
more information about migrating BASIC SAVE files.
Data File
The main difference between compatibility mode data files and native mode
data files is the internal representation of floating-point format. Data
file word length is 2 bytes (16 bits) on both MPE V and MPE XL machines.
Real and short real data types in native mode data files are in IEEE
floating-point format. Real and short real data types in compatibility
mode data files are in MPE V floating-point format. See chapter 4,
"Migrating Business BASIC/V Files," for more information about data file
migration.
Floating-Point Real Format
Floating-point real format is represented differently on MPE XL systems
than on MPE V systems. On MPE XL, real numbers are represented in IEEE
real format.
The range of real on MPE XL is:
[-1.79769313486231E+308 .. -4.94065645841247E-324],
0,
[ 4.94065645841247E-324 .. 1.79768313486231E+308 ]
The range of short real on MPE XL is:
[-3.40282E+38 .. -1.40129E-45],
0,
[ 1.40129E-45 .. 3.40282E+38 ]
Default minimum and maximum values for real data types are different in
HP Business BASIC/XL. The ranges of short real on MPE XL are smaller than
those on MPE V. Calculations and assignments result in short real
overflow when MPE XL short real limits are reached. On MPE V, both real
numbers and short real numbers have exponents up to +/-77. The IEEE
format for real numbers allows exponents of +308/-324 and the format for
short real numbers allows exponents of only +38/-45. On MPE V, you can
change real values to short real values without risking an overflow.
This is not true on MPE XL. You might need to develop new error handling
code.
MPE XL IEEE real format is accurate to only 15.9 digits so MPE XL only
displays 15 significant digits for real data type; internal MPE V real
format is accurate to 16.5 digits so MPE V displays 16 significant
digits.
Floating-Point Decimal Format
Floating-point decimal format is the same on MPE V and MPE XL. However,
MPE XL floating-point decimal range extends to [-9.99999999999E511...
9.99999999999E511]. Programs that fail because of decimal overflow on
MPE V might not overflow on MPE XL because of the larger decimal range.
Intrinsic File. HP Business BASIC/XL looks for intrinsic routine
definitions in the default intrinsic file (SYSINTR.PUB.SYS) when you do
not specify a filename in an INTRINSIC definition. On MPE V, the default
intrinsic file is SPLINTR.PUB.SYS. You can still specify (in the
intrinsic statement) the intrinsic file you want searched for external
procedure header information.
MPE XL native mode internal intrinsic file format is different from MPE
V.
The MPE V (and compatibility mode MPE XL) default file searched for
intrinsic definitions is SPLINTR.PUB.SYS. The SPLINTR file (and intrinsic
definition files that you create) use the SPL compiler. The SPLINTR file
stores a limited amount of information about each procedure (including
the number and type of each parameter).
The MPE XL native mode default file searched for intrinsic definitions is
SYSINTR.PUB.SYS. Create SYSINTR files by using BUILDINT in the Pascal
compiler. SYSINTR files contain more information about the procedure and
each parameter than SPLINTR files and MPE V intrinsic files: You can
include a default value and the anticipated alignment and offset in each
parameter description. The two types of intrinsic files have
dramatically different formats. Refer to the HP Pascal Reference Manual
for more information about setting up your own intrinsic definitions in
native mode.
Define intrinsics as INTRINSIC instead of EXTERNAL routines. The actual
name used to call the intrinsic is in the intrinsic file. The intrinsic
file returns the actual name of the external's entry point when the
native mode compiler processes the INTRINSIC statement definition.
Hence, intrinsic calls are case sensitive.
Some intrinsics are specific to and are not available to native mode
programs. Intrinsic calls must exist in the intrinsic file. Intrinsic
calls with empty parameters are only allowed when the intrinsic file
specifies a default value for the missing parameter. Intrinsic names
truncate after 60 characters.
The intrinsic mechanism has a limited ability to specify default values
for selected MPE XL types. You do not need to specify an actual
parameter to correspond to a formal parameter when the intrinsic's
parameter information specifies a default for the formal parameter. The
default value from the intrinsic file is used when the call is made and
there is a missing actual parameter.
Default extension parameters are used when missing actual parameters have
both a default value and a subsequent actual parameter supplied. Supply
the subsequent actual parameter in the parameter list.
Expression Evaluation with Short Integer Constants
Integer constants are stored as 4-byte integer constants on MPE XL. On
MPE V, short integers can overflow during expression evaluation because
intermediate results within the range of [-32768, 32767] are stored as
short integer constants. On MPE XL, short integers will not overflow
during expression evaluation, but may overflow on a subsequent assignment
to a short integer variable. For example, the following line produces
different results on MPE V and MPE XL:
10 IF 32767 + 12 THEN PRINT "fine"
MPE V result:
Short integer overflow
MPE XL result:
fine
No overflow error occurs.
Externals
External names (except intrinsics) are shifted to lowercase unless you
specify an alias clause. Alias names are case sensitive and are not
downshifted.
Maximum external name length is 60 characters in HP Business BASIC/XL.
External names are truncated after the first 60 characters. Business
BASIC/V truncates external names after the first 15 characters.
The entry point name for intrinsics is part of the information returned
from the intrinsic file.
Add relocatable object modules for externals to an executable library.
Specify the name of the executable library in the XL parameter of the RUN
command if the library name is other than "XL.PUB.SYS".
On MPE XL, external names are case sensitive; it is therefore possible to
have two different procedures, one called "myprog" and another called
"MYPROG". On MPE V, external names are not case sensitive.
In native mode, system intrinsics are generally in upper case (for
example: "FOPEN"), and user procedures are in lower case (for example:
"myprog"). Therefore, HP Business BASIC/XL changes external names to
lower case. Use the ALIAS option of the EXTERNAL statement to call
external procedures whose names are upper case.
The MPE XL search order for resolving externals is similar to the MPE V
search order (when LIB = G, P, and S is specified). Native mode
executable library names are XL rather than SL. Specify a list of
executable libraries to search by using the RUN command as in the example
below:
RUN MYPROG; XL="lib1,lib2,lib3"
The externals are resolved by searching the following files in the order
specified:
MYPROG ->LIB1 ->LIB2 ->LIB3 ->XL.PUB.SYS ->
NL.PUB.SYS
Filecode of Program and Data Files
Native mode HP Business BASIC/XL program and data file filecodes are
different from MPE V filecodes and a different name is associated with
each file type.
Table 3-1. Filecode of Program and Data Files
----------------------------------------------------------------------------------------------
| | | |
| Name | Filecode | Description |
| | | |
----------------------------------------------------------------------------------------------
| | | |
| BSAVE | 1244 | Business BASIC/V SAVE file |
| | | |
----------------------------------------------------------------------------------------------
| | | |
| BSVXL | 1247 | HP Business BASIC/XL SAVE |
| | | file |
| | | |
----------------------------------------------------------------------------------------------
| | | |
| BDATA | 1242 | Business BASIC/V DATA file |
| | | |
----------------------------------------------------------------------------------------------
| | | |
| BDTXL | 1248 | HP Business BASIC/XL DATA |
| | | file |
| | | |
----------------------------------------------------------------------------------------------
| | | |
| BBNCM | 1249 | Business BASIC/V binary |
| | | file1 |
| | | |
----------------------------------------------------------------------------------------------
Notes
1 Add this filecode to compatibility mode binary files that are accessed
by native mode HP Business BASIC/XL programs. Files containing this
filecode still run in compatibility mode.
You can use the filecode in the LISTF command to distinguish between file
types. To list all the BASIC DATA files in your group on MPE V, type:
Example:
CATALOG TYPE = "BDATA"
To list all the BASIC DATA files in your group on MPE XL, type the
following from the HP Business BASIC/XL interpreter:
Example:
CATALOG TYPE = "BDTXL"
There are many other ways to use filecodes. Change your source programs
if they depend on the filecode name for HP Business BASIC/XL data files.
Invoking the Interpreter and Compiler
The commands used to invoke the HP Business BASIC/XL interpreter and
compiler are different from those used to invoke the Business BASIC/V
interpreter and compiler. The commands are shown below:
Table 3-2. Invoking the Interpreter and Compiler
----------------------------------------------------------------------------------------------
| | | |
| Function: | Business BASIC/V | HP Business BASIC/XL |
| | | |
----------------------------------------------------------------------------------------------
| | | |
| Interpret | BBASIC | BBXL |
| | | |
----------------------------------------------------------------------------------------------
| | | |
| Compile | BBASICOMP | BBXLCOMP |
| | | |
----------------------------------------------------------------------------------------------
| | | |
| Compile and Link | BBASICPREP | BBXLLK |
| | | |
----------------------------------------------------------------------------------------------
| | | |
| Compile, Link, and Run | BBASICGO | BBXLGO |
| | | |
----------------------------------------------------------------------------------------------
The parameters for the HP Business BASIC/XL commands follow:
BBXL [commandfile] [,textfile] [,listfile] [,libfile] [;INFO = "info"]
BBXLCOMP [textfile] [,object file] [,listfile] [;INFO ="info"]
BBXLLK [textfile] [,progfile] [,listfile] [;INFO ="info"]
BBXLGO [textfile] [,listfile] [,libfile] [;INFO ="info"]
On MPE XL machines, multiple compiles to the same relocatable object file
overwrite the file each time. Change your command files accordingly so
they write to a different file for each compile. Refer to the HP Link
Editor/XL Reference Manual for information about linking object modules.
Remember to examine all your User Defined Commands (UDCs) or command
files and change the appropriate commands for compiling and linking.
String and Array Boundary
The maximum string and array sizes are larger in HP Business BASIC/XL
than in Business BASIC/V. Use the following rule to calculate either the
maximum number of elements in an array:
maximum elements = (8190000 DIV No_of_bytes* )
Notes. * No_of_bytes is the total number of bytes needed to store the
data type.
Table 3-3. String and Array Boundary
---------------------------------------------------------------------------------------------
| | |
| data type | No_of_bytes |
| | |
---------------------------------------------------------------------------------------------
| | |
| SHORT INTEGER | 2 |
| | |
---------------------------------------------------------------------------------------------
| | |
| INTEGER | 4 |
| | |
---------------------------------------------------------------------------------------------
| | |
| SHORT REAL | 4 |
| | |
---------------------------------------------------------------------------------------------
| | |
| REAL | 8 |
| | |
---------------------------------------------------------------------------------------------
| | |
| SHORT DECIMAL | 4 |
| | |
---------------------------------------------------------------------------------------------
| | |
| DECIMAL | 8 |
| | |
---------------------------------------------------------------------------------------------
The maximum string length in HP Business BASIC/XL is 32760.
Subunit Size
The maximum size of a subunit in HP Business BASIC/XL is much larger than
it is in Business BASIC/V. In Business BASIC/V, the limit is about 700 to
800 lines, in HP Business BASIC/XL, the limit is about 2000 lines or
greater. This is an estimate of subunit size. The actual number of
lines allowed depends on the complexity of your program.
SYSTEM
SYSTEM statements and ":" commands enable execution of UDCs and command
files from HP Business BASIC/XL. The MPE XL SYSTEM statement executes the
contents of the SYSTEM string as if you input the command directly. The
value of JCW CIERROR changes to reflect new errors if a warning occurs.
10 SYSTEM "SETJCW CIERROR = 0" !reset CIERROR to 0
20 SYSTEM "PURGE notthere" !purge a file that does not exist
30 SYSTEM "SHOWJCW CIERROR" !show value of CIERROR
Business BASIC/V result:
WARNING FILE NOT FOUND, NO PURGE DONE. (CIWARN 383)
CIERROR = 0
HP Business BASIC/XL result:
WARNING FILE NOT FOUND, NO PURGE DONE. (CIWARN 383)
CIERROR = 383
New Parameters in SYSTEMRUN
There are four new parameters in the SYSTEMRUN statement for running
native mode programs. The four new parameters are NMSTACK, NMHEAP, XL,
and UNSAT:
Table 3-4. SYSTEMRUN Parameters
------------------------------------------------------------------------------------------
| |
| Parameter Description |
| |
------------------------------------------------------------------------------------------
| |
| NMSTACK The maximum size, in bytes, that the NM stack can grow to. |
| |
| NMHEAP The maximum size, in bytes, that the NM heap can grow to. |
| |
| XL Specifies which libraries to search and what order to search |
| them in. This resolves any conflict with external references. |
| XL overrides LIB = when both are specified. |
| |
| UNSAT Specifies the default procedure to link in case any of the external |
| references cannot be resolved to available libraries.* |
| |
------------------------------------------------------------------------------------------
Notes
* The procedure DEBUG will be linked if an external reference in the
example below cannot be resolved to an available library.
Example:
RUN foo; XL = "mylib"; UNSAT = debug
For more information about these parameters, refer to the MPE XL
Intrinsics Manual or type "HELP RUN".
MPE/iX 5.0 Documentation