HP 3000 Manuals

Replacing Removed Features [ HP Business BASIC/XL Migration Guide ] MPE/iX 5.0 Documentation


HP Business BASIC/XL Migration Guide

Replacing Removed Features 

The BASIC/V features listed below were not implemented in HP Business
BASIC/XL. Remove them from your applications to avoid problems.

COMPLEX Data Type 

The COMPLEX data type and the built-in functions that deal with that type
do not exist in HP Business BASIC/XL. Rewrite BASIC/V programs that use
this data type so they are usable in HP Business BASIC/XL.


NOTE You can use the REA function on complex numbers to return the real part of the number. This function can also change non-complex numbers to REAL numbers. The migration aid automatically translates the REA function to the HP Business BASIC/XL SREAL function.
Complex Numbers HP Business BASIC/XL doesn't support complex numbers. If you need to use complex numbers and complex arithmetic, use two-element real arrays to hold the values and to define your own functions to perform the arithmetic and the input/output. EXTERNAL SPL and FORTRAN 66 routines MPE XL does not support SPL or FORTRAN 66 in native mode. Although SPL and FORTRAN 66 routines work in compatibility mode, they are not easy to call from native mode programs. There are two options for SPL and FORTRAN 66 external routines: 1. Rewrite in a native mode language. 2. Call by using a switch stub for each routine. Native mode languages include: * HP FORTRAN/XL * HP C/XL * HP Pascal/XL * HP COBOL II/XL Before rewriting these routines in another language, check to see if HP Business BASIC/XL offers the capability provided by the routine. For example, many programmers wrote routines in other languages to provide an interface between BASIC/V and system intrinsics. HP Business BASIC/XL can call system intrinsics directly, so these routines are no longer necessary. If rewriting the routines is unfeasible, refer to the Switch Programming Guide for information about the switch subsystem and program access through switch stubs. Routines called from BASIC/V programs might need substantial modifications to be called from HP Business BASIC/XL programs. This is because most of these routines rely on BASIC/V's parameter passing scheme and on the internal representation of BASIC/V strings and arrays. BASIC/V's parameter passing scheme is described in appendix G of the BASIC/V Reference Manual. For example, many routines assume strings are preceded by two bytes that contain the maximum and actual lengths of the string. Because BASIC/V only allows strings up to 255 characters, only a byte is needed for each length. However, in HP Business BASIC/XL, strings can be much longer and a full word, 32 bits, is needed for representing string length. There are similar differences for arrays. Built-In Functions HP Business BASIC/XL does not support the built-in functions CSH, SNH, TNH, and RND. The migration aid automatically changes calls to these functions so you can use them by adding an equation to your program. Adding equations for each type of function you use is the only manual change required. These are the definitions of CSH, SNH, and TNH: CSH(x)=(EXP(X)+ EXP(-x))/2 SNH(x)=(EXP(X)-EXP(-x))/2 TNH(x)=SNH(X)/CSH(x) CSH. HP Business BASIC/XL does not support the hyperbolic cosine function CSH. The single-line function below generates the hyperbolic cosine of an argument expressed in radians: DEF FNCsh(X)=(EXP(X)+EXP(-X))/2 The migration aid changes CSH calls to FNCsh calls. You can insert the single-line function definition and modify it to use degrees or grads. A faster method is to call the system compiler library directly with an EXTERNAL declaration in your program. Use the following declaration for a function that takes a REAL (64-bit) argument and returns a REAL result: EXTERNAL REAL FNCsh ALIAS "DCOSH"(REAL X) Use the declaration below for a short real argument and a short real result: EXTERNAL SHORT FNCsh ALIAS "COSH"(SHORT X) SNH. HP Business BASIC/XL does not support the hyperbolic sine function SNH. The single-line function below generates the hyperbolic sine of an argument expressed in radians: DEF FNSnh(X)=(EXP(X)-EXP(-X))/2 The migration aid changes SNH calls to FNSnh calls. You can insert the single-line function definition and modify it to use degrees or grads. A faster method is to call the system compiler library directly with an EXTERNAL declaration in your program. Use the following declaration for a function that takes a real (64-bit) argument and returns a real result: EXTERNAL REAL FNSnh ALIAS "DSINH"(REAL X) Use the declaration below for a short real argument and a short real result: EXTERNAL SHORT FNSnh ALIAS "SINH"(SHORT X) TNH. HP Business BASIC/XL does not support the hyperbolic tangent function TNH. The single-line function below generates the hyperbolic tangent of an argument expressed in radians: DEF FNTnh(X)=(EXP(X)-EXP(-X))/(EXP(X)+EXP(-X)) The migration aid changes TNH calls to FNTnh calls. You can insert the single-line function definition and modify it to use degrees or grads. A faster method is to call the system compiler library directly with an EXTERNAL declaration in your program. Use the following declaration for a function that takes a REAL (64-bit) argument and returns a REAL result: EXTERNAL REAL FNTnh ALIAS "DTANH"(REAL X) Use the declaration below for a short real argument and a short real result: EXTERNAL SHORT FNTnh ALIAS "TANH"(SHORT X) RND. To generate a repeatable sequence of random numbers in HP Business BASIC/XL, leave the RANDOMIZE statement out of the program. To generate a non-repeatable sequence, include the RANDOMIZE statement in the program. INVOKE (Interpreted) There is no exact equivalent for interpreted BASIC/V INVOKE statements. However, the compiled BASIC/V INVOKE statement is similar to the HP Business BASIC/XL CALL statement. For more information about migrating compiled INVOKE statements, see "Migrating Changed Features" in this chapter. Print Functions in Formatted Output HP Business BASIC/XL does not support print functions in PRINT USING statements. Print functions include TAB, SPA, LIN, and CTL. Use the IMAGE statement to format output. UND Built-in Function HP Business BASIC/XL does not support the undefined (UND) built-in function. Instead of using UND, initialize all variables to unlikely values immediately after you declare them, then write a single-line function that takes a scalar variable or an array element and returns true if that variable or element equals the unlikely value. If the single-line function returns true, it means no other assignments have been made. Name this function FNUnd. USLINIT and SEGMENT Since USL files and SEGMENTS do not exist in MPE XL, USLINIT and SEGMENT do not have any meaning in HP Business BASIC/XL. They do not have any effect on your program except to generate warnings.


MPE/iX 5.0 Documentation