The missing links for Pascal. (evaluation) John J. Hirschfelder.
The Missing Links for Pascal
Serious Pascal programmers, particularly those whose business programs involve data entry, will welcome three new products for the Apple from Link Systems.
LinkDisk, a disk manipulation utility; LinkVideo, a screen utility; and LinkIndex, a utility for rapid key retrieval are designed to facilitate program development in Pascal.
LinkDisk is a free-standing Pascal utility program which provides an assortment of disk maintenance functions absent from the Apple Pascal Filer: translation of DOS 3.3 binary and text files to Pascal files, comparison of files and volumes, examination and hexadecimal editing of disk files, and listing of text files on the printer. The operation procedures of the LinkDisk are similar to those of the Apple Pascal Filer.
LinkVideo and LinkIndex are not complete programs, but packages of procedures (units in Apple Pascal terminology) which may be called from user-written application programs. They are intended for the serious programmer of data entry, storage, and retrieval applications for business--the programmer for whom time spent reinventing the wheel is money lost. The procedures of LinkVideo provide screen control functions and "operator-proof' input of common data items such as telephone numbers, social security numbers, and strings, and include some basic data validation. LinkIndex handles an index file associated with a user's data file, providing a capability comparable to the Indexed Sequential Access Method of Cobol.
Each of the three products is provided on a disk with a user's manual. All files on the disks may be readily copied for the use of the original purchaser using the Transfer function of the Pascal Filer.
LinkDisk, the utility program, provides four groups of functions: DOS 3.3 file translation, file and volume comparison, file enumeration and editing, and listing.
With a DOS 3.3 disk in one of the disk drives, LinkDisk displays a catalog of the disk in either of two formats. One format is similar in content to the DOS CATALOG display but is arranged differently. The other format provides more information including, for binary files, the start address and length. Upon command, LinkDisk translates a selected text or binary file on the DOS 3.3 disk to a Pascal file on the disk in the other drive.
The Compare function of LinkDisk will compare, byte for byte, two Pascal files or two whole volumes to determine wherther a verbatim copy has been correctly made. It will also compare two DOS 3.3 disks.
The Examine function permits byte-by-byte display and editing of a Pascal file (or volume). One disk block is displayed at a time, with a byte-sized (two-character) cursor. Data can be displayed in ASCII, hexadecimal, or mixed. In ASCII display mode, non-printable characters are displayed as "?'. In mixed mode, printable characters are displayed by their ASCII characters and non-printable characters are displayed in hexadecimal. Editing of a block display is done by using the standard Pascal cursor controls (left-arrow, right-arrow, ctrl-o, ctrl-l) and by typing corrections in hex.
The List function is ideal for obtaining printed listings of large Pascal programs whose text extends over several text files. The user is presented with the directory of a volume from which he selects those text files he wishes to list. He may also specify whether he wishes files ordered alphabetically by name, by date, or in the order found in the directory, as well as the number of lines per page, whether or not pages are to be titled, and whether or not lines are to be numbered. Then the entire list of selected files is printed.
The LinkDisk user's manual is concise and well written. The program itself is mostly self-explanatory in its operation, so there should be little need to refer to the operating procedures after one reading. The procedure descriptions in the manual occasionally omit a prompt present in the program. For instance, the Select Option of the List function prompts for a unit number, which is not mentioned in the procedure. The manual also fails to mention that the disk volume supplied is named DISKS:. The experienced Pascal user will not be bothered by these omissions, but they may be annoying to a novice.
LinkVideo is a package of fifteen Pascal procedures useful to the writer of data entry programs. One procedure, VDT (for Video Display Terminal) is called with one parameter which selects one of the following high level screen operations: home cursor, clear screen, clear the line that the cursor is on, erase from cursor to end of line, erase from cursor to end of screen, and move cursor up, down, left, or right.
The remaining procedures are output and input procedures for seven data types: string, phone number, Boolean, social security number, date, integer, and long integer. In each case, the calling program provides screen position (row and column). For string, integer and long integer, a field width is also provided by the caller. On input, the calling program provides a default value which is displayed. Then the operator is afforded an opportunity to change it.
Each character typed by the operator is checked for validity. Invalid characters are ignored, and the computer beeps. The cursor is constrained to the data field displayed and the first position to the right of it; no operator error short of hitting RESET will prevent a valid data item from being returned to the calling program when the operator types RETURN. Therein lies the principal benefit of this procedure package.
Punctuation in dates, phone numbers, and social security numbers is fixed and the operator can't change it; only significant digits are accepted. In the case of long integers, the calling program specifies the position of an assumed decimal point; the point is displayed, and the operator can't change it. The validity checking on dates is deficient. In the month field, the numbers 0 through 12 are accepted. In the day field, the numbers 0 through 31 are accepted and 40 and up are rejected, while days of 32 through 39 are garbled with no error indication.
The user's manual, like that of LinkDisk, is concise and well written. It includes detailed descriptions of the procedures and their parameters, a discourse on the unit concept in Apple Pascal and the relative merits of regular and intrinsic units, and a procedure for installing the package in the SYSTEM. LIBRARY file. The procedure, using the LIBRARY program supplied with the Apple Pascal System, is entirely standard but long, so its complete presentation here is welcome even to the expert.
The procedure contains one error: The response to the NEW LINK CODE prompt should be VIDEO:VIDEO, not BLANK:VIDEO as stated in the manual. Again, the manual has failed to mention the name of the disk volume.
The disk supplied contains the complete source and object code for these procedures, the source and object code for an assembly language subroutine which it uses, and the source and object code for a demonstration program called TESTVIDEO. After installing the package in his library, the user should run the demonstration program to get an operator's feel for how these procedures work. He should then print and peruse the source code for both the demonstration program and the procedures. He will then be ready to write his own nearly foolproof data entry program with a minimum of effort.
LinkIndex is the most sophisticated of the three products. It provides the serious business programmer with a capability in Pascal comparable to the Indexed Sequential Access Method (ISAM) in Cobol. LinkIndex is not an ISAM implementation; rather, it is an index file handler. The application programmer must do his own handling of his data file; LinkIndex won't touch it. Thus, while the index is invisible to the programmer in ISAM, it is highly visible in LinkIndex--but it is seen only through a set of procedures providing high level operations on the index.
To build a data storage and retrieval application using LinkIndex, the user sets up a random access data file, so that when he adds a record to his file, he knows its record number. Then he uses one of the procedures of this package, called EnterKeyInBTree, to place a key in the index. The key contains the record number of the newly created record and the value of a field in this record which the user wishes to use to retrieve the record. He may enter several keys for the same record. Then, when he wants to retrieve a record, he provides the key field value to another procedure, called KeyInBTree. This procedure provides the record number (or signals that the key can't be found). With the record number, the file operations SEEK and GET can be used on the data file to retrieve the record.
The complete set of procedures in this package is as follows: CreateBTree creates a new index file. OpenBTree opens an existing index file. EnterKeyInBTree inserts a new key in the index. RemoveKeyFromBTree removes a key from the index. GetNextKey finds the next larger key in the index (for sequential access in increasing order). GetPriorKey finds the next smaller key in the index (for sequential access in decreasing order). And CloseBTree closes an index file.
Actually, all but the last of these are Boolean functions, which return TRUE if the operation was successful and FALSE otherwise. If FALSE, a variable BTreeResult contains an explanatory code. closeBTree always succeeds.
The user's manual, at 50 pages, is the most comprehensive of the manuals for the three products. It includes an introduction, a tutorial using a phone list program as an example, specifications of the procedures and their parameters, and a programming guide covering a variety of technical issues such as memory requirements, file space planning, and error handling.
Appendix A is source listing of the interface portion of the package--unlike LinkVideo, source code is not provided. Appendix B is brief but scholarly discussion of file access methods, including ISAM and the binary tree algorithms used in LinkIndex. Appendix C contains directions for installing the unit in SYSTEM. LIBRARY. It is similar to the comparable portion of the LinkVideo manual and contains the same minor error--the volume supplied is named LINDEX:, not BLANK:.
The disk supplied contains the code file for the unit, called BTREE.CODE; a text file, DOC.TEXT, containing additional documentation; and seven files relating to the phone list example including source code, object code, and data.
DOC.TEXT contains a listing of differences among versions, describing which bugs were fixed in which, guidance on file size and heap space estimating, and a discussion of the Apple III version. It also contains the specifications for the GetPriorKey funtion, which was added to the package after the manual was printed. The information on bugs in prior versions is especially welcome, as it indicates a continuing interest on the part of this vendor insupporting and improving his products.
LinkIndex is one of the most technically advanced software products for the Apple that I have seen. For the serious programmer of business applications, the effort required to understand and use this package will be repaid with improved program performance with less programming effort.
Products: Link Systems LinkDisk (editing equipment)
Link Systems LinkVideo (editing equipment)
Link Systems LinkIndex (editing equipment)