FEATURES OF THE BASIC 7.1
Home
This is part of the book: «Basic v7.1. Getting Started.»
for the QuickBasic Extended 7.1, aka PDS, that
describes the features of the PDS 7.0 and the 7.1.
CHAPTER 1. THE NEW FEATURES
Changes for the version 7.1 are indicated by the words «Version 7.1».
Microsoft Basic version 7.1 extends Basic's power under OS/2, improves its compatibility with other languages, and provides new language features:
(A).– Basic's Indexed Sequential Access Method (Isam) is now fully supported for OS/2.
(B).– The Programmer's WorkBench (PWB) provides a sophisticated development environment for mixed-language programming under Dos or OS/2.
(C).– The CodeView debugger version 3.0 contains many improvements to simplify the tasks of debugging large Basic and mixed-language programs under Dos or under OS/2.
(D).– QuickHelp provides access to the Microsoft Advisor Help system from the command line.
(E).– The new Redim Preserve statement lets you change the size of an array without erasing the data it contains.
(F).– Basic now supports passing parameters by value within Basic procedures and passing arrays containing fixed length strings as parameters.
(G).– Basic is fully compatible with Microsoft C version 6.0.
The rest of this chapter discusses the features new to Microsoft Basic versions 7.0 and 7.1 in greater detail.
INTEGRATED ISAM
The 'Indexed Sequential Access Method' package provides a fast and simple method for accessing specific records in large and complex data files. Microsoft Basic integrates all Isam statements and functions with the Basic language.
Basic Isam includes statements for transaction processing and for data retrieval and manipulation. Version 7.1.– In this version, the Isam statements and functions are supported for OS/2 as well as Dos.
ISAM
Microsoft Basic also includes several utilities for use with Isam files created with Basic:
Isamcvt.exe (Dos only) converts Btrieve and dBase files for use with Isam.
Isamrepr.exe repairs corrupted Isam databases.
Isampack.exe compacts Isam files to save disk space.
Isamio.exe converts Ascii files to Isam format and vice versa.
DOS FILE MANAGEMENT
The Dir$ and Curdir$ functions and the Chdrive statement make it easier to manage Dos files from Basic programs. Dir$ is similar to the Dos Dir command, except that the filenames are returned one at a time. Curdir$ returns the current directory specification, and Chdrive changes the current drive.
CURRENCY DATA TYPE
The currency data type maintains to-the-penny precision while providing the speed of integer math for programming accounting tasks. Its internal representation as an integer gives this type a significant advantage in speed over the floating-point data type for operations such as addition and subtraction.
PROCEDURE-LEVEL ERROR HANDLING
Microsoft Basic contains local error trapping and handling for procedures, making error handling much more efficient. In previous versions of Basic, error-handling routines existed at the module level.
When a handler was turned on, it was active for all procedures within the module. With Microsoft Basic, you can create both module-level and procedure-level error handlers.
The same error can invoke different error-handling routines, depending on which procedure is running.
For example, you may want to invoke different error-handling routines for Err code 54, Bad File Mode, because the error has different meanings for different file operations.
STATIC ARRAYS IN RECORDS
In previous versions of Basic, you could create user-defined data structures that contained numeric and fixed-string data types by using the Type...End Type statements. Now you can use static arrays in addition to numeric and string data types, which gives you more flexibility in building data structures.
PRESERVE DATA WHEN REDIMENSIONING AN ARRAY
Version 7.1.– By adding the Preserve option to the Redim statement, you can preserve the data that exists in an array when changing its outer boundary. This simplifies the dynamic control of the amount of memory consumed by an array.
IMPROVED PARAMETER PASSING
Version 7.1.– With previous versions of Basic, you could emulate passing parameters by value by surrounding the parameter with parentheses. Now you can use the Byval keyword in Declare, Sub, and Function statements for Basic procedures.
For details on passing parameters by value, see the online Help for the Declare, Sub, and Function statements. Basic now also supports passing arrays containing fixed-length strings as parameters.
IMPROVED COM SUPPORT WITH ERDEV$ AND ERDEV
With previous versions of Basic, if you had a device timeout error, there was no way to find out which device timed out, or which control line caused the timeout. With Microsoft Basic, information about the timeout is available through the Erdev$ and Erdev functions.
Erdev$ indicates whether a timeout is occurring on the communications port. Erdev indicates the type of timeout error that occurred (that is, Cts, Dsr, or Dcd control-line errors).
DATE/TIME, FINANCIAL, AND FORMAT ADD-ON LIBRARIES
With these new libraries, you can use Basic to perform spreadsheet-style calculations and formatting. For example, you can compute the number of days between two dates by converting the dates from month-day-year format to number format, and then subtracting.
You can use financial functions to calculate double-declining balance depreciation, future value, net present value, internal rate of return, and other common financial calculations.
MATRIX MATH TOOLBOX
The new Matrix Math toolbox contains sample Basic code for several common matrix math operations, including addition, subtraction, multiplication and division, matrix inversion, determinant calculation and solution of simultaneous equations using Gaussian elimination.
PRESENTATION GRAPHICS TOOLBOX
You can use the Presentation Graphics toolbox to display charts and graphs from your programs. The Presentation Graphics toolbox includes procedures for pie charts, bar and column charts, line graphs, and scatter diagrams. The toolbox also includes a set of special graphics fonts.
USER INTERFACE TOOLBOX
With the new user interface code samples, you can design your own user interface using Basic procedures. The code samples in this toolbox give you complete control of character-based window interfaces. For example, you could write a Basic program with multiple windows, menu bars, dialog boxes, and mouse interaction.
C VERSION 6.0 COMPATIBILITY
Version 7.1.– Basic incorporates the C version 6.0 startup code. This makes Basic fully compatible with the latest version of C. However, this can cause problems for mixed-language programmers who have earlier versions of C, Fortran, or Pascal. Compatible run-times for these languages are available free from Microsoft.
CAPACITY AND PERFORMANCE ENHANCEMENTS
Microsoft Basic eliminates many of the capacity and performance barriers that formerly limited the size and sophistication of Basic applications.
FAR STRING SUPPORT
In previous versions of Basic, all variable-length string data was stored in near memory. This relatively small portion of memory (64 Kbs. maximum) also stores the rest of the simple variables--integers, floating-point numbers and fixed strings, all constants, the stack, and some run-time overhead.
Even when the only variables you use are variable-length strings, your maximum data storage is limited. Microsoft Basic supports «far strings», which enable you to store variable-length string data outside of near memory in multiple segments of far memory.
This gives you a full 64 Kbs. of string storage in the module level of the main module, plus several additional 64 Kbs. blocks of storage, depending on how you write your program. Removing variable-length strings from near memory creates significantly more room for other simple variables.
OVERLAY SUPPORT
With overlays, you can write and run programs up to almost 16 megabytes in size when compiling and linking from the command line. In an overlaid version of a program, specified parts of the program are only loaded if and when they are needed. Specifying overlays can be useful if you have compiled a program that is too large to load in memory.
IMPROVED GRANULARITY
The extent to which Basic run-time routines are divided into individually accessible pieces is called «granularity». With Microsoft Basic's improved granularity, you can link with the minimum amount of library code needed to produce stand-alone programs. This gives you smaller compiled programs, saving disk space and memory.
OPTIMIZED CODE GENERATION
Optimized code generation automatically makes compiled Basic programs smaller and faster. Also, using a new compiler switch, you can tell the compiler to generate code for the 80286 (and later) microprocessor family, taking advantage of that family's machine instructions.
IMPROVED ALTERNATE MATH PACKAGE
For target systems without an 80x87 math coprocessor, the alternate math package gives programs greatly improved speed. For example, if your application involves spreadsheet-style math without recursive calculations, using the alternate math package may give you a noticeable performance increase.
IMPROVED IEEE MATH COPROCESSOR EMULATION
For target systems with or without a math coprocessor, an improved coprocessor emulator gives you faster high precision calculations.
IMPROVED CODE GENERATION
Version 7.1.– Relative jumps and short jumps to near targets are optimized, resulting in smaller, faster programs. This improvement affects all control statements.
ENVIRONMENT AND USABILITY ENHANCEMENTS
Microsoft Basic offers two sophisticated development environments: Microsoft QuickBasic Extended (QBx) and Microsoft Programmer's WorkBench (PWB). Both provide the following advanced features:
(A).– Integrated debugging capabilities within the environment and compatibility with CodeView version 3.0 for debugging and optimizing executable programs at a variety of levels.
(B).– Support for expanded memory specification (Ems 4.0) to create large executable programs.
(C).– Undo/redo capabilities.
(D).– Customizable menus and key assignments.
(E).– Control of build options and target environment from the development environment.
(F).– A comprehensive online Help system designed for professional programmers.
(G).– In addition to QBx and the PWB, the Basic now includes the QuickHelp environment for viewing Microsoft Advisor online Help files.
THE QUICKBASIC EXTENDED ENVIRONMENT
Microsoft QuickBasic Extended (QBx) is an advanced development environment for programmers who write most or all of their code in Basic. It provides line-by-line syntax checking and on-demand program execution without recompiling. QBx also provides the following key features:
(A).– QBx automatically uses expanded memory, if present, for any parts of your program source code that are less than 16 Kbs. in size. The View Subs command now enables you to determine whether a program unit (module-level code or procedure) will fit into expanded memory.
(B).– Historical Undo/redo commands. You can use Undo to step back through your last 20 edits.
(C).– A customizable Utility menu. You can use the Utility menu to run Dos command-line programs or a custom editor, or for command-line compiling and overlay linking. You can even assign each menu item a shortcut key.
(D).– Customizable key assignments. If you prefer to use a set of editing commands other than the QBx defaults, you can change your key file to one of those provided, or you can create your own custom assignments.
(E).– nPrint to multiple printers or to a file.
(F).– Debug watch window capacity doubled (from 8 to 16 expressions).
(G).– Complete control of compiler switches for compiling from the environment.
THE PROGRAMMER'S WORKBENCH ENVIRONMENT
Version 7.1.– Microsoft Programmer's WorkBench (PWB) is an advanced development environment for programmers who often work in languages other than Basic or who want to create, build, and debug their programs under OS/2. The PWB also offers the following key features:
(A).– The PWB runs in real or protected modes, so you can write Basic programs under Dos or OS/2.
(B).– You can write programs in any Microsoft professional level language and mix languages, such as Basic and C, within the environment.
(C).– The Source Browser allows you to search selected files, list references and definitions, build a call tree and outline, and view a list of relationships among program symbols.
(D).– You can step through compiler errors and the PWB will indicate where each error occurred in the source code.
(E).– The PWB and CodeView are integrated, so you can switch from one to the other without exiting the PWB.
(F).– Comprehensive Help is available on all command-line utilities and Microsoft languages installed on your system.
THE CODEVIEW DEBUGGER
Version 7.1.– The CodeView debugger allows you to debug programs under Dos or OS/2. This is especially useful when you are using assembly language routines in a Basic program. CodeView version 3.0 offers the following new features:
(A).– Comprehensive online Help on how to use CodeView. Help is also available on any installed Microsoft language or utility from within CodeView.
(B).– Automatic use of extended and expanded memory, if available.
(C).– Full integration with the PWB and compatibility with programs created in QBx.
QUICKHELP
Version 7.1.– Microsoft QuickHelp reads Microsoft Advisor online Help files under Dos or OS/2. This provides you with an easy way to get Help on the command-line utilities and development environments without loading QBx, the PWB, or CodeView.
If you are using OS/2 or Microsoft Windows, you can run QuickHelp in one window and do your programming in another. This can be more convenient than using Help in the programming environment, which obscures part of the program you are working on.