Английская Википедия:CALL/360:BASIC

Материал из Онлайн справочника
Перейти к навигацииПерейти к поиску

Шаблон:Short description 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 Шаблон:Key could be entered directly as Шаблон:Key. Differences are otherwise minor.

History

CALL/360:BASIC was announced in 1968,[1] along with several other languages for the system including APL and FORTRAN and the Datatext markup language based text editor. Early advertizing for the system boasted that one could "Start learning CALL / 360 : BASIC after breakfast and you can share our computer before lunch".[2]

The CALL/360 suite was developed within IBM's Information Marketing department. Initially, the products were considered proprietary and could only be accessed via the online service. Customer demand forced them to offer these products to other System/360 users, which they did by releasing it on an "as is" basis with no support.[3] Later the same year, IBM transferred this department, along with the rest of its timesharing services, to the Service Bureau Corporation (SBC),[4] including the CALL/360 operating system and CALL/360:BASIC. Manuals after that date refer to the language as an SBC product.Шаблон:Sfn

In 1973, SBC was itself transferred to Control Data Corporation as part of a long running anti-trust lawsuit.[5]

Description

CALL/360:BASIC is almost identical to Dartmouth BASIC the Fourth, including support for the advanced Шаблон:Coderix math features. It differs primarily in its support of file handling.Шаблон:Sfn

Basics

The language included the commands LET, PRINT, END, FOR...NEXT with an optional Шаблон:Code,Шаблон:Efn GOTO, GOSUB...RETURN, IF...THEN, IF...GOTO, DEF, READ, DATA, RESTORE DIM, and REM. To this list, it added computed GOTO of the form Шаблон:Code.Шаблон:Sfn Note that the Шаблон:Code in an Шаблон:Code statement can only be followed by a line number, the idea of allowing arbitrary statements after Шаблон:Code did not appear until later.Шаблон:Sfn Шаблон:Codearks are always shown with a colon in the manual, Шаблон:Code or Шаблон:Code, but it is not clear if these were required.Шаблон:Sfn The Шаблон:Code, Шаблон:Code and Шаблон:Code commands could also be followed by a comment string, where a colon was not required.Шаблон:Sfn

Шаблон:Code was expanded with Шаблон:Code followed by a line number. The line referred to started with a colon and then a series of formatting strings. This series of strings was known as an "image".Шаблон:Sfn Items to be printed could be separated by commas or semicolons, with commas having "print zones" 18-characters wide.Шаблон:Sfn A new command, Шаблон:Code, stopped the program with a statement Шаблон:Samp and then waited for the user to enter text, which was ignored. The end-of-line character caused the program to continue.Шаблон:Efn It could also be followed by a comment in the source.Шаблон:Sfn

It also included the same basic set of math instructions as Dartmouth, Шаблон:Kbd, Шаблон:Kbd, Шаблон:Kbd and Шаблон:Kbd, as well as the up-arrow for exponents and adding the two-asterisk form, Шаблон:Code.Шаблон:Sfn Logical operators included the standard set of Шаблон:Kbd, Шаблон:Kbd, Шаблон:Kbd, Шаблон:Kbd, Шаблон:Kbd and Шаблон:Kbd, as well as the special character versions, Шаблон:Kbd, Шаблон:Kbd, Шаблон:Kbd.Шаблон:Sfn It included the standard set of mathematical functions from Dartmouth, adding Шаблон:Code, Шаблон:Code, Шаблон:Code, Шаблон:Code, Шаблон:Code, Шаблон:Code, Шаблон:Code, Шаблон:Code, Шаблон:Code for base-2 logs, and Шаблон:Code for base-10. It also included Шаблон:Code and Шаблон:Code functions to convert between degrees and radians,Шаблон:Sfn and three pre-defined internal constants, Шаблон:Code, Шаблон:Code and Шаблон:Code, which could be used instead of typing in the actual numbers.Шаблон:Sfn

CALL/360 included string variables, only recently introduced to Dartmouth, using the same dollar-sign notation. It added the ability to delimit string constants with either single or double quotes, as well as the ability to type two of either character within a string to include a single character of that type. For instance, Шаблон:Code represents Шаблон:Kbd.Шаблон:Sfn Strings were broken into 18-character lengths internally, and strings that did not use up an entire 18-character record were padded with blanks, meaning Шаблон:Code would be interpreted as 18 spaces.Шаблон:Sfn

Arrays and matrix math

Like early versions of Dartmouth, CALL/360:BASIC supported one and two dimensional arrays, with the lower index always being 1. Thus an array defined using Шаблон:Code contains three values, A(1) through A(3). CALL/360 also added the ability to define string arrays, with each entry being a single 18-character string.Шаблон:Sfn In contrast to Dartmouth, it does not appear variables were always DIMed; in Dartmouth one could refer to Шаблон:Code without dimensioning A, in which case it had a default behaviour of being Шаблон:Code. The manual does not explicitly say CALL/360 does not do this, but it does state variables cannot be used in matrix operations without being dimensioned. A maximum of 29 numeric arrays were allowed in a program, with the total sum of the elements across all arrays being no more than 7167.Шаблон:Sfn

CALL/360:BASIC included most of the matrix commands from Dartmouth, including the ability to perform basic math on a matrix as a single operation, like Шаблон:Code where A is an array that will then have all of its elements multiplied by 10. It also included the functions Шаблон:Code, Шаблон:Code Шаблон:Code,Шаблон:Sfn Шаблон:Code and Шаблон:Code.Шаблон:Sfn Data could be loaded into a matrix with Шаблон:Code and output with Шаблон:Code. To these original commands they also added Шаблон:Code and Шаблон:Code, which were used to read or write all the elements in a matrix to or from a file.Шаблон:Sfn

Files

The major addition to CALL/360:BASIC was a usable file handling system. This started with the Шаблон:Code which opened a file and assigned it to the provided file number, 10 in this case, which could be an expression. Reading from the file was accomplished with Шаблон:Code in the same general fashion as the Шаблон:Code statement. Writing was handled by the otherwise identical Шаблон:Code.Шаблон:Sfn The file pointer could be moved back to the start of the file with Шаблон:Code followed by one or more file numbers. There was no way to specify a position within a file.Шаблон:Sfn Шаблон:Code with a similar list of one or more file numbers freed the file handles.Шаблон:Sfn

Example

The following program opens the file Шаблон:Mono for input as file handle 10, and then reads lines of data containing a product name and four sales prices in a loop. Notice that the loop is not terminated, instead, this program ends when it runs out of data and causes a Шаблон:Mono error. How control is passed to line 70 at that point is not explained in the manual. The output to the screen is formatted using the image on line 50.Шаблон:Sfn Шаблон:Sxhl

Notes

Шаблон:Notelist

References

Citations

Шаблон:Reflist

Bibliography

Шаблон:BASIC