IBM System/36 BASIC
| Company type | Programming language |
|---|---|
| Industry | Computer software |
| Founded | 1983 |
| Owner | IBM |
IBM System/36 BASIC was an interpreted language designed for the IBM System/36 midrange system, launched in 1983. Consistent with BASIC dialects of its time, it relied on line numbering and did not incorporate contemporary features such as procedures or object properties.
In contrast to certain 1970s BASIC variants that employed unconventional techniques like direct memory manipulation through and , System/36 BASIC refrained from these but supported basic terminal control commands such as triggering the Alarm via . Programming keywords were required to be uppercase, with lowercase letters automatically converted unless used within comments.
To align with the System/36 platform, IBM enhanced BASIC by integrating hardware- and software-specific capabilities including the file type, handling of indexed, direct access, and sequential disk files, management of multiple printer files, and library-based program LOAD/SAVE functionality.
Statements, functions, and commands
Fundamental BASIC statements encompassed:
DATA, DIM, END, FOR...NEXT, GOSUB...RETURN, GOTO, IF...THEN, INPUT, LET, ON...GOTO, PRINT, PRINT USING, READ, REM, STOP
Available functions included:
ASC(), RND(), SIN(), COS(), TAN(), TAB(), SQRT(), LOG()
IBM-supplied advanced statements introduced features such as:
ON ERROR (for error trapping), OPTION (to set program-wide parameters like array base or numeric precision), OPEN/CLOSE (for file and device handling), WRITE/REWRITE/APPEND/DELETE (to manipulate file records), IMAGE and FORM (for formatting records), DEF FN..FNEND (enabling user-defined functions), CHAIN (to invoke other program modules).
Printing-related commands comprised:
PRINT #255: (sending output to the default printer), PRINT NEWPAGE (clearing the screen), PRINT #255: NEWPAGE (advancing to a new printer page).
Array indexing utilities:
AIDX() and DIDX() generated ascending and descending index arrays to facilitate sorting references; SRCH() and SRCH$() performed searches within arrays for numeric or string values respectively.
Additional operational commands included:
RENUMBER (to reorganize program line numbers), LOAD/SAVE (for managing programs within libraries), OFF (to terminate a session), LISTP (to print program listings).
The statement enabled robust error handling to avoid abrupt program termination. Variations allowed trapping specific exceptions such as overflow or division by zero errors.
The statement controlled numeric precision settings—using for double or long precision and for single precision—and array base indexing with options like or . These configurations were critical given the 64K memory constraint per program.
Unlike RPG II on S/34 and S/36 systems that lacked inter-program invocation capabilities, System/36 BASIC permitted programs to call others via , passing variables as parameters.
Input/output operations supported multiple formats: unformatted I/O through /; formatted output using ; field-oriented I/O via /; and workstation file interactions employing screen formats generated by SDA through and .
Statements defining record layouts used COBOL-style syntax with placeholders representing numeric or alphanumeric fields; specified variable lengths similarly to RPG conventions. Labels provided named targets for control flow instructions such as GOTO or GOSUB.
File management followed COBOL-like conventions: files could be opened sequentially, indexed, or accessed relatively. Records were added using WRITE combined with APPEND; updates were performed with REWRITE; deletions utilized DELETE—applicable solely to user-defined fixed-length record files.
Printing required associating device files; a default printer file (#255) linked to the session's default printing device. Additional printer files (#1–254) could be created with parameters specified in OPEN statements. The keyword allowed detection of printer page overflow events.
Although S/36 BASIC did not include built-in array sorting routines, programmers could emulate sorting by generating index arrays via AIDX or DIDX that mapped sorted positions back to original array elements.
Programs were stored in libraries through , maintaining modules as subroutine members. System/36 files operated independently from libraries; for example:
The RENUMBER command recalculated all internal line references following line number adjustments.
System/36 BASIC incorporated powerful yet potentially hazardous commands:
- permanently erased user files unless prevented by security settings or active usage.
- locked source code irreversibly; users were advised to preserve unlocked copies prior to locking.
Differences Between S/34 and S/36 Compatibility
Although System/34 BASIC and System/36 BASIC share many similarities, variations in their machine code architecture hinder the straightforward transfer of subroutine member BASIC programs from one platform to the other.
Refer also to the Square Root of 2 & PI π calculations that were developed on mainframe systems throughout the 1980s and 1990s.