System/34 BASIC

Last updated

IBM System/3 BASIC was an interpreter for the BASIC programming language for the IBM System/34 midrange computer. [1]

Contents

System/34 BASIC was first offered in 1978, and as such, contained many of the trappings that a BASIC program would have encountered in the time period of the TRS-80, or many other offerings of the 1970s and early 1980s. [2] As such, S/34 BASIC uses conventions that are no longer standard in modern BASICs, such as line numbers, and does not support newer features such as WHILE/WEND, DO/ENDDO, WITH/END WITH, procedures, properties, and so forth.

BASIC conventions

BASIC statements are expected to be entered in capital letters, and while the operator can press Cmd2 to use lowercase, the BASIC interpreter will convert non-comment keywords into uppercase.

So that BASIC could be useful in a midrange computing environment, IBM added extensions to the language that were specific to the hardware and software conventions of the IBM System/34 Family, such as the WORKSTN file, support for indexed, direct, and sequential disk files, the ability to open and close multiple printer files, and LOAD/SAVE from libraries on the fixed disk.

BASIC statements

These core BASIC statements, functions, and commands were used:

<nowiki/>DATADIMENDFOR...NEXTGOSUB...RETURNGOTOIF...THENINPUTLETON...GOTOPRINTPRINTUSINGREADREMSTOPASC()RND()SIN()COS()TAN()TAB()SQRT()LOG()LIST

More advanced IBM-supplied statements included:

<nowiki/>ON ERRORAllowserrortrappingOPTIONPermitsprogram-widepropertiessuchasBase1orBase0arrayindexing,longorshortprecision,etc.OPENAllowsafileordevice(formattedworkstation,printer)tobeopenedCLOSEClosesafileordeviceWRITEOutputstoafileordeviceREWRITEChangesarecordordisplayformatAPPENDAddstoafileDELETEDeletesarecordfromafileIMAGEDefinestheformatofarecordusingCOBOL-likesyntaxFORMDefinestheformatofarecordusingRPG-likesyntaxDEF FN..FNENDDefinesafunctionCHAINLoadsandpassescontroltoanotherBASICprogramPRINT#255:Printstothe(default)printerfilePRINTNEWPAGEClearsthescreenPRINT#255:NEWPAGEAdvancestothenextpageontheprinterfileAIDX()Referstotheascendingindexofanarray,whichisanarrayofrelativesortedpointerstoarrayelementsDIDX()SameasAIDXbutusesadescendingindexSRCH()UsedtofindavalueinanarraybyretrievingthematchpointerSRCH$()UsedtofindastringvalueinastringarraybyretrievingthematchpointerRENUMBERAcommandusedtorenumberthelineswithinaprogramLOADAcommandusedtoloadaprogramfromalibraryonthefixeddiskSAVEAcommandusedtosaveaprogramtoalibraryonthefixeddiskOFFAcommandusedtoexittheinteractiveBASICsessionLISTPAcommandusedtolistthecurrentprogramtotheprinter

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/34 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 where the lowest-numbered index is 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 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. FNEND is placed after the last statement in a function.

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/34 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/34 applications. WRITE and READ, as well as PRINT USING and INPUT USING, can direct BASIC to a line number or a label that contains the keyword "IMAGE:".

An IMAGE statement contains decimals, commas, dollar signs, dashes, and pound signs ("#") in representation of the substituted numeric or alphameric values.

3540IMAGE:###-##-#################################$#,###,###.##

A FORM statement denotes the size of the variables to be read or written. To save a numeric value of .00 to 99,999.99, use this notation:

2959FORMN7.2

A label is a tag on a line as follows:

260BEGIN_CALCULATIONS::270FORX=1TO12280Y=Y+X*1.08290NEXTX

If desired, the statement GOSUBBEGIN_CALCULATIONS can be used instead of GOSUB260.

OPEN, CLOSE, WRITE, REWRITE, DELETE, and APPEND are already familiar to COBOL programmers and describe the actions taken to access S/34 disk files using BASIC. It isn't possible to access every single type of S/34 file because these include system files, libraries, and folders, but every user-created S/34 file with a fixed record length (only FORTRAN programs can use variable record lengths) will suffice. Disk files can be opened sequentially, by index, or relatively (by record number). If a file is delete-capable, records can be deleted using the DELETE statement. To add a record, use WRITE (with APPEND specified in the OPEN statement) and to update use REWRITE.

Printing

In S/34 BASIC, to print to the printer, a device file must be used. A default printer file called #255 always exists when BASIC is started. It has a printer name of BASIC255 and opens the device that is the default printer for the terminal that begins a BASIC session. If desired, it is possible to create a different printer file numbered between 1 and 254. Use OPEN#x:PRINTER,NAME= and so forth to do this, specifying columns or device ID or other parameters as needed. The PAGEOFLOW keyword can be used to trap the page overflow condition for the printer.

Array

Some versions of BASIC allow the programmer to sort an array. S/34 BASIC doesn't provide a function for this, but it does provide an interesting remedy. The programmer can define an array with the same number of elements as the target array and use AIDX or DIDX to create an ascending or descending index. Each element of the new array will contain a number representing the ordinal sorted position of the target array, so if AMERICA is the sixth element of array A$ but first in alphabetical order, then setting A() = AIDX(A$) would cause A(1) to contain the value 6.

To save a BASIC program to a library member, SAVE is used, and REPLACE when an update is made.

SAVE PROG1,PGMRLIB causes the current module to be saved as a subroutine member (type R) named PROG1 in a user library named PGMRLIB.

Note that System/34 files are not part of libraries. If a disk file is named FNF001, then an OPEN statement like this one can work:

OPEN#3:"NAME=FNF001,SEQUENTIAL",INPUT

It doesn't matter which library is used to access file FNF001.

RENUMBER is the S/34 BASIC command used to renumber statements. All internal references to statement numbers are immediately recalculated.

System/34 BASIC has a very dangerous command called FREE. Typing FREE followed by a filename deletes that file without a trace. It will work for every user file, unless there is a conflict of security or an in-use condition that blocks it.

System/34 BASIC has another dangerous command called LOCK. The LOCK command will make the current program source code inaccessible and it is not reversible. Always save an unlocked copy before using LOCK.

Incompatibility Between S/34 and S/36

In 1983, IBM announced the System/36 family of midrange computers.

System/34 BASIC and System/36 BASIC are very similar; however, machine code incompatibility makes it impossible to port a subroutine member BASIC program between these systems.

Related Research Articles

Applesoft BASIC is a dialect of Microsoft BASIC, developed by Marc McDonald and Ric Weiland, supplied with the Apple II series of computers. It supersedes Integer BASIC and is the BASIC in ROM in all Apple II series computers after the original Apple II model. It is also referred to as FP BASIC because of the Apple DOS command FP used to invoke it, instead of INT for Integer BASIC.

<span class="mw-page-title-main">GW-BASIC</span> Dialect of the BASIC programming language

GW-BASIC is a dialect of the BASIC programming language developed by Microsoft from IBM BASICA. Functionally identical to BASICA, its BASIC interpreter is a fully self-contained executable and does not need the Cassette BASIC ROM found in the original IBM PC. It was bundled with MS-DOS operating systems on IBM PC compatibles by Microsoft.

<span class="mw-page-title-main">Atari BASIC</span> Dialect of the BASIC programming language

Atari BASIC is an interpreter for the BASIC programming language that shipped with the Atari 8-bit family of 6502-based home computers. Unlike most American BASICs of the home computer era, Atari BASIC is not a derivative of Microsoft BASIC and differs in significant ways. It includes keywords for Atari-specific features and lacks support for string arrays.

Microsoft BASIC is the foundation software product of the Microsoft company and evolved into a line of BASIC interpreters and compiler(s) adapted for many different microcomputers. It first appeared in 1975 as Altair BASIC, which was the first version of BASIC published by Microsoft as well as the first high-level programming language available for the Altair 8800 microcomputer.

Commodore BASIC, also known as PET BASIC or CBM-BASIC, is the dialect of the BASIC programming language used in Commodore International's 8-bit home computer line, stretching from the PET (1977) to the Commodore 128 (1985).

Job Control Language (JCL) is a name for scripting languages used on IBM mainframe operating systems to instruct the system on how to run a batch job or start a subsystem. The purpose of JCL is to say which programs to run, using which files or devices for input or output, and at times to also indicate under what conditions to skip a step. Parameters in the JCL can also provide accounting information for tracking the resources used by a job as well as which machine the job should run on.

<span class="mw-page-title-main">IBM 1130</span> 16-bit IBM minicomputer introduced in 1965

The IBM 1130 Computing System, introduced in 1965, was IBM's least expensive computer at that time. A binary 16-bit machine, it was marketed to price-sensitive, computing-intensive technical markets, like education and engineering, succeeding the decimal IBM 1620 in that market segment. Typical installations included a 1 megabyte disk drive that stored the operating system, compilers and object programs, with program source generated and maintained on punched cards. Fortran was the most common programming language used, but several others, including APL, were available.

In computing, a line number is a method used to specify a particular sequence of characters in a text file. The most common method of assigning numbers to lines is to assign every line a unique number, starting at 1 for the first line, and incrementing by 1 for each successive line.

MBASIC is the Microsoft BASIC implementation of BASIC for the CP/M operating system. MBASIC is a descendant of the original Altair BASIC interpreters that were among Microsoft's first products. MBASIC was one of the two versions of BASIC bundled with the Osborne 1 computer. The name "MBASIC" is derived from the disk file name MBASIC.COM of the BASIC interpreter.

HP Time-Shared BASIC is a BASIC programming language interpreter for Hewlett-Packard's HP 2000 line of minicomputer-based time-sharing computer systems. TSB is historically notable as the platform that released the first public versions of the game Star Trek.

Color BASIC is the implementation of Microsoft BASIC that is included in the ROM of the Tandy/Radio Shack TRS-80 Color Computers manufactured between 1980 and 1991. BASIC is a high level language with simple syntax that makes it easy to write simple programs. Color BASIC is interpreted, that is, decoded as it is run.

<span class="mw-page-title-main">Simons' BASIC</span>

Simons' BASIC is an extension to BASIC 2.0 for the Commodore 64 home computer. Written by British programmer David Simons in 1983, who was 16 years old at the time, it was distributed by Commodore as a cartridge.

<span class="mw-page-title-main">System Support Program</span> Operating system for IBM minicomputers

System Support Program (SSP) was the operating system of the IBM System/34 and System/36 minicomputers. SSP was a command-based operating system released in 1977.

IBM System/36 BASIC was an interpreter for the IBM System/36 midrange computer.

<span class="mw-page-title-main">MTS system architecture</span> Software organization of the Michigan Terminal System

MTS System Architecture describes the software organization of the Michigan Terminal System, a time-sharing computer operating system in use from 1967 to 1999 on IBM S/360-67, IBM System/370, and compatible computers.

SUPER BASIC, sometimes SBASIC for short, is an advanced dialect of the BASIC programming language offered on Tymshare's SDS 940 systems starting in 1968 and available well into the 1970s.

Data General Extended BASIC, also widely known as Nova Extended BASIC, was a BASIC programming language interpreter for the Data General Nova series minicomputers. It was based on the seminal Dartmouth BASIC, including the Fifth Edition's string variables and powerful MAT commands for matrix manipulation. In contrast to the compile-and-go Dartmouth BASIC, Extended BASIC was an interpreter.

Wang BASIC is a series of BASIC programming languages for computers from Wang Laboratories. The term can be used to refer to the BASIC on any Wang machine, but is mostly associated with the versions on the Wang 2200 minicomputer series of the early 1970s. When these machines were updated to the VP series in 1976, BASIC-2 was introduced and remained the pattern for future machines in the 2200 series. A planned BASIC-3 was never released.

CALL/360:BASIC was an IBM dialect of the BASIC programming language for the System/360 and later platforms. It was based on mid-1960s versions of Dartmouth BASIC but added a number of extensions. Most of these were related to file handling, which, at that time, Dartmouth lacked. It also added support for the mathematical symbols found on some IBM terminals, so that <= could be entered directly as . Differences are otherwise minor.

References

  1. "IBM Archives: System/34". www.ibm.com. 2003-01-23. Retrieved 2022-05-18.
  2. "IBM System/34...Because Nobody Wants to Wait | Selling the Computer Revolution | Computer History Museum". www.computerhistory.org. Retrieved 2022-05-18.