Skip to content

Review: IBM’s APL2 on the PC (32-bit)

Vector 6:2, page 52

reviews implementations

Transcribed from the printed issue; not yet reviewed. Read it in the PDF of the issue, page 52

Introduction

This offering from IBM, based on its mainframe APL2 interpreter (APL2/370), comes with 18 device drivers, 29 workspaces, two interpreters (16 bit and 32 bit) and a packager - hence the word “brief” in the title of this report.

Documentation consists of the APL2 language Reference manual (as distributed for APL2/370) and a 300 page manual specific to the PC. The former (the release 3 version) is very clear and easy to use, as reference manuals go, and its presence indicates the extent to which APL2/PC follows APL2 on the mainframe.

Indeed, when running with the full-screen APL2 session manager, which is almost identical to that on the mainframe, APL2/PC has a very familiar appearance, but leaves the habitual PC user longing for enhancements, in particular in respect of cursor movement and scrolling through the session log.

The testing for this review was carried out on an IBM PS/2 Model 80-071 with 2 Mbytes of memory and a VGA monitor, running IBM DOS 3.3, under which there was 563 kbytes of memory free of the 640 kbytes accessible. Most of the testing was performed using the 32 bit version of the interpreter.

Installation

A batch file is supplied to perform the installation; the documentation does not mention it, but installation is onto drive C:, so a quick bit of editing is required if the desired destination is some other drive (though a well-written batch file would have allowed parameter substitution).

Specimen batch files APLON and APLOFF are supplied to assist in the provision of an APL character set, for EGA, VGA, or PC Convertible monitors, and a number of printers. These use code page switching, so DOS 3.3 or later is required; the documentation describes how to modify AUTOEXEC.BAT and CONFIG.SYS for those not already using this facility. There is also a program APL2FONT for those unable or unwilling to use code page switching.

Clearly these bits and pieces need to be put together in a batch file that will be run to invoke APL2/PC. Example files are given, though they fail to include the command CALL on the line calling APLON (and ditto APLOFF), without which the batch file will terminate prematurely.

All that remains is to select a few likely auxiliary processor names to put on the line calling the interpreter, and away we go!…

… but to where? Once the initial excitement has worn off, one wonders how one might put values on function keys, to replace the defaults, and how to set up a few libraries. Here the documentation lets one down a little; a couple of references to the supplied workspaces PROFILE and EDIT, with a pointer to the use of )IN would save a lot of searching.

It was at this point that I met my first problem: when using one of the supplied functions for full screen editing, there was a one character delay between keyboard action and the updating of the screen. Having managed to extricate myself from the grasp of the editor, I set about investigating the matter. After rebooting from a DOS disk there was no problem; a few more rebootings revealed that the cause of the difficulty was the IRMA2 keyboard driver and keyboard macro driver. The same problem arose if in my AUTOEXEC file I used the DOS command KEYB to select the UK keyboard.

Differences between APL2/PC and APL2/370

Some ten pages of the PC documentation describe differences between APL2 on the PC and what is described in the APL2 Language Reference manual. Most of these differences fall into one of the following categories: deviations from APL2/370; implementation restrictions; system dependency.

The deviations relating to fill items and formatting may be irritating to anyone wishing to develop applications for a mainframe on the PC; other deviations are unlikely to cause any problem.

Of the restrictions, the following are the most significant:

(i) No complex arithmetic (a workspace is supplied to emulate this).
(ii) Axis specification on scalar functions and partition is not implemented.
(iii) Selective specification is not implemented.
(iv) Name association is not implemented, though a similar facility is available through AP2.
(v) )CONTINUE does not save the workspace, but acts like )OFF. (This seems dangerous - why not disable the command?)
(vi) There are no facilities for setting the size of the workspace.
(vii) )EDITOR is not implemented. (It is a disgrace that there is no full-screen editor built in.)

The system dependent differences include a system function to perform peeks and pokes.

It should also be noted that storage for integer variables is only two bytes in the 16-bit version.

Auxiliary Processors

I had neither facilities nor time to investigate all the APs provided in the package, so the following sections give a brief idea of just some of them. For information, here is a complete list of the APs:

AP2 Interface to non-APL programs
AP80 IBM graphics printer control
AP100 PC/DOS host command interface
AP101 Stack and profile manager
AP103 BIOS/DOS interrupt handling and I/O port control
AP120 Full-screen APL2 session manager
AP124 Full-screen display management
AP172 IBM PC Network communications
AP190 IBM PC 3278/79 communications
AP190I IRMA PC 3278/79 communications
AP190P IBM 3270 PC, PC/G or PC/GX communications
AP206 Graphics processor
AP210 DOS file management
AP211 APL2 object library management
AP232 Asynchronous communications
AP440 Music generator
AP488IBM IBM GPIB/IEEE488 communications
AP488NI National Instruments GPIB/IEEE488 communications
AP998 Logic processor

There is at least one workspace to assist in the use of each of these APs. In my limited experience of these, I found them inadequately tested and generally short on comments and lacking in general description, but containing plenty of useful functions.

Should none of the above APs meet your requirements, create one yourself, following the instructions in the chapter entitled “How to Write an Auxiliary Processor”.

A maximum of 15 APs may be loaded at any one time, though they may be dynamically loaded and unloaded via AP2.

AP2 ……… Interface to non-APL programs
The manual gives an example of how this may be used to invoke the DOS command FORMAT. I was unable to persuade this to work as described, invariably getting from DOS the message “Format failure” at the first attempt to run the program and “Invalid parameter” on subsequent attempts. There is a supplied workspace to assist in producing FORTRAN subprograms to use with APL2 functions.
AP101 ……… Stack and profile management
It is easy to edit the functions in the PROFILE workspace to set up function keys and define libraries, as required.
AP120 ……… Full-screen APL2 session manager.

This is a bug-ridden attempt to emulate the mainframe APL2 session manager, which will leave users who are accustomed to the speed and flexibility of the PC longing for facilities for key-controlled scrolling through the log, for rapid cursor movement, and for recalling previous commands.

Most of the bugs are mere irritations, but be warned not to try to alter the size of the log from the default 8k.

Another problem arises when one executes a DOS command using )HOST dos_command or starts a DOS session using )HOST In the former case, output from DOS is splattered over the session manager screen (disappearing when control returns to APL2 and Enter, Page Up or Page Down are pressed), whilst for the latter the session manager screen is left as a background.

AP124 ……… Full-screen display management

This is IBM’s FSM facility. An important deficiency from the point of view of a PC user is the absence of any means to constrain the movement of the cursor to specified regions of the screen.

Only one pair of shared variables is allowed, which means that one cannot readily perform full-screen editing for the dynamic debugging of functions using AP124.

AP210 ……… DOS file management

Facilities are provided for the handling of DOS files, whether for holding APL objects, bit strings, or ASCII with CR/LF delimiters; both direct and sequential access may be used. These appear to work well, and may also be used to send output to a printer, by treating the DOS device LPT1 as a file.

One omission is a facility to determine the size of a file. This means that native files cannot be read as a chunk with a single DOS call; instead, they must be read a line at a time, with repeated DOS calls, which is slow.

The only problem I noted was in the failure to deal adequately with the DOS end-of-file marker. This is exemplified by the function READFILEV in the workspace FILE: when reading an ASCII file with the usual CR/LF delimiters and terminated by an end-of-file marker, the lines of the file are returned as elements of a vector, but the last element is the last line of the file with its first character replaced by the end-of-file marker. The cause of the problem is the failure of the direct read facility of the AP to detect the true length of a record that is not terminated by a CR/LF pair.

Supplied Workspaces

A few comments follow on some of the supplied workspaces that I sampled in addition to those described in the previous section.

DEMO206
this demonstrates what can be done with AP206, illustrating medium resolution graphics and including an animation effect.
DOSFNS
this contains functions to carry out various DOS commands, such as changing drive or directory, via AP103. The function DATE illustrates how not to use backspace in conjunction with quote-quad input - the current date is displayed on the screen, but is not read as input if Enter is pressed.
EDIT
this contains a number of functions for editing APL functions and variables. There is some lack of consistency between these functions, however: function EDIT uses F3 to save and end, whilst EDIT2 uses F2 to save and F3 to quit (also, F3 always asks “Quit without saving?”).

Keyboard Problems.

To switch between the APL keyboard and the National keyboard one uses Ctrl or Alt with Backspace. I experienced a number of problems with this facility, the chief being that, apparently unpredictably, I would get locked into switching between two graphics keyboards.

Another difficulty arises when invoking DOS or a DOS application via the )HOST command: one finds that the APL keyboard is still active, and that certain key combinations (e.g. those using Ctrl) are not recognized. Pressing Ctrl- or Alt- Backspace may solve or alleviate the problem. Sometimes pressing the Caps Lock key causes the Num Lock light to come on; pressing Num Lock seems to stop this, though the Caps Lock light may end up at the wrong setting.

When one is in APL2/PC Caps Lock has no effect, and Num Lock does not activate the keyboard indicator.

When the APL2 session is terminated and one returns to DOS, the keyboard sometimes behaves as if Ctrl is held down; usually, pressing Ctrl-S twice restores normality.

Packaging Workspaces.

This facility is available only for the 16-bit version of the interpreter. It enables one to convert workspace applications into executable (.EXE) files, making it possible to run them on machines without an interpreter (or a run- time licence). It works well - need one say more?

Workspace Transfer.

The system commands )OUT and )IN, to write and read APL transfer format files, make it easy to transfer workspaces between the 16-bit and 32-bit interpreters.

Performance.

On my machine (with 2 Mbytes of memory), the 32-bit interpreter gives me a clear workspace of 1.4 Mbytes, nearly 0.5 Mbytes more than I get in APL*PLUS II. For basic arithmetic and function execution, however, APL2/PC is up to 50% slower.

The 16-bit version gave me a workspace of 378 kbytes, some 7 kbytes less than APL*PLUS/PC V7, which ran a little more slowly.

Conclusion.

The overall impression of this system is that it is very powerful, but that a lot of elbow-work is required to make it into a really polished product.

As the documentation stands, this would be a difficult product for a first-time APL user, though a brief, well-written chapter directed at beginners could make all the difference (and be of use to the rest of us!).