IBM System/36 BASIC
IBM System/36 BASIC was an interpreter for the IBM System/36 midrange computer.
Like other BASICs licensed by IBM, S/36 BASIC was compatible with ANSI Minimal BASIC and had considerable extensions to it in order to be useful with the host.
These core BASIC statements, functions, and controls were used:
DATA DIM END FOR...NEXT GOSUB...RETURN GOTO IF...THEN INPUT LET ON...GOTO PRINT PRINT USING READ REM STOP
More advanced IBM-supplied statements included:
ON ERROR OPTION OPEN CLOSE WRITE REWRITE APPEND DELETE IMAGE FORM DEF FN..FNEND CHAIN
ON ERROR is an error-trapping statement that allows BASIC to suspend an error that might otherwise stop a BASIC program from running and perform an error-handling routine instead. Variants include suffixing OFLOW, ZDIV, and other error types to a statement and immediately trap these errors.
OPTION allows the BASIC program to meet special criteria. Sometimes BASIC did not have very much user space (since all S/36 programs are limited to 64K) and the area called "code space" which contains the current user program must reside within the user space. Therefore, users could choose OPTION LPREC which causes BASIC to compute with double-precision (long) numerics, or OPTION SPREC which provides more space and single-precision (short) numerics. Some programmers prefer matrix mathematics to begin with 0, others prefer 1. OPTION BASE 0 and OPTION BASE 1 accomplish this. There are other uses for OPTION.
RPG II programs on the S/34 and S/36 could not call each other, but BASIC programs could, using the CHAIN statement. CHAIN passes control from the current BASIC module to the named module, bearing a list of arguments which can become variables in the new module when it is loaded.
DEF FN allows the definition of a user function in BASIC which can be named and referred in the program.
There are four ways to format BASIC input and output. First, unformatted; just PRINT and INPUT to your heart's content. Second, with PRINT USING, which in S/36 BASIC can incorporate a constant, a string variable, a line number, or a label. Third, with PRINT FIELDS and INPUT FIELDS, which place 5250-type display fields on the CRT in immediate mode. Fourth, by using a workstation file (opened with OPEN #x: "WS,NAME=" and so forth) and performing various combinations of WRITE and READ to that workstation file, using SDA-generated screen formats similar to those in other S/36 applications.