Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Niidae Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Fortran
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===FORTRAN=== The initial release of FORTRAN for the IBM 704<ref name="Sayre_1956"/> contained 32 types of [[Statement (programming)|statements]], including: * {{code|DIMENSION}} and {{code|EQUIVALENCE}} statements * Assignment statements * Three-way [[Arithmetic IF|''arithmetic'' {{code|IF}}]] statement, which passed control to one of three locations in the program depending on whether the result of the arithmetic expression was negative, zero, or positive * Control statements for checking exceptions ({{code|IF ACCUMULATOR OVERFLOW}}, {{code|IF QUOTIENT OVERFLOW}}, and {{code|IF DIVIDE CHECK}}); and control statements for manipulating [[front panel|sense switches and sense lights]] ({{code|IF (SENSE SWITCH)}}, {{code|IF (SENSE LIGHT)}}, and {{code|SENSE LIGHT}}) * [[goto|{{code|GO TO}}]], computed {{code|GO TO}}, {{code|ASSIGN}}, and assigned {{code|GO TO}} * {{code|DO}} loops * Formatted I/O: {{code|FORMAT}}, {{code|READ}}, {{code|READ INPUT TAPE}}, {{code|WRITE OUTPUT TAPE}}, {{code|PRINT}}, and {{code|PUNCH}} * Unformatted I/O: {{code|READ TAPE}}, {{code|READ DRUM}}, {{code|WRITE TAPE}}, and {{code|WRITE DRUM}} * Other I/O: {{code|END FILE}}, {{code|REWIND}}, and {{code|BACKSPACE}} * {{code|PAUSE}}, {{code|STOP}}, and {{code|CONTINUE}} * {{code|FREQUENCY}} statement (for providing [[optimization (computer science)|optimization]] hints to the compiler). The arithmetic {{code|IF}} statement was reminiscent of (but not readily implementable by) a three-way comparison instruction (CAS—Compare Accumulator with Storage) available on the 704. The statement provided the only way to compare numbers—by testing their difference, with an attendant risk of overflow. This deficiency was later overcome by "logical" facilities introduced in FORTRAN IV. The {{code|FREQUENCY}} statement was used originally (and optionally) to give branch probabilities for the three branch cases of the arithmetic {{code|IF}} statement. It could also be used to suggest how many iterations a {{code|DO}} loop might run. The first FORTRAN compiler used this weighting to perform ''at compile time'' a [[Monte Carlo method|Monte Carlo simulation]] of the generated code, the results of which were used to optimize the placement of basic blocks in memory—a very sophisticated optimization for its time. The Monte Carlo technique is documented in Backus et al.'s paper on this original implementation, ''The FORTRAN Automatic Coding System'': <blockquote>The fundamental unit of program is the [[basic block]]; a basic block is a stretch of program which has one entry point and one exit point. The purpose of section 4 is to prepare for section 5 a table of predecessors (PRED table) which enumerates the basic blocks and lists for every basic block each of the basic blocks which can be its immediate predecessor in flow, together with the absolute frequency of each such basic block link. This table is obtained by running the program once in Monte-Carlo fashion, in which the outcome of conditional transfers arising out of IF-type statements and computed GO TO's is determined by a random number generator suitably weighted according to whatever FREQUENCY statements have been provided.<ref name="Backus57" /></blockquote> The first FORTRAN compiler reported diagnostic information by halting the program when an error was found and outputting an error code on its console. That code could be looked up by the programmer in an error messages table in the operator's manual, providing them with a brief description of the problem.<ref name="Sayre_1956" />{{rp|p.19–20}}<ref>{{cite book |publisher=Programming Research Department, International Business Machines Corporation |title=The FORTRAN Automatic Coding System for the IBM 704 EDPM : Preliminary Operator's Manual |date=April 8, 1957 |pages=6–37 |url=http://www.softwarepreservation.org/projects/FORTRAN/manual/Prelim_Oper_Man-1957_04_07.pdf |archive-url=https://web.archive.org/web/20140226151253/http://www.softwarepreservation.org/projects/FORTRAN/manual/Prelim_Oper_Man-1957_04_07.pdf |archive-date=February 26, 2014 |url-status=live }}</ref> Later, an error-handling subroutine to handle user errors such as division by zero, developed by NASA,<ref>{{cite web|first=Betty Jo |last=Armstead|date=January 21, 2015|url=https://spaceodyssey.dmns.org/media/62497/myyearsatnasa-_bettyjoarmstead.pdf|title=My Years at NASA|website=Denver Museum of Nature & Science|access-date=June 15, 2019|archive-date=December 24, 2019|archive-url=https://web.archive.org/web/20191224083647/https://spaceodyssey.dmns.org/media/62497/myyearsatnasa-_bettyjoarmstead.pdf |url-status=dead}}</ref> was incorporated, informing users of which line of code contained the error. ====Fixed layout and punched cards==== {{See also|Computer programming in the punched card era}} [[File:FortranCardPROJ039.agr.jpg|thumb|FORTRAN code on a [[punched card]], showing the specialized uses of columns 1–5, 6 and 73–80]] [[File:FortranCodingForm.png|thumb|A reproduction of a FORTRAN coding form, printed on paper and intended to be used by programmers to prepare programs for punching onto cards by [[keypunch]] operators. Now obsolete.]] Before the development of disk files, text editors and terminals, programs were most often entered on a [[keypunch]] keyboard onto 80-column [[punched card]]s, one line to a card. The resulting deck of cards would be fed into a card reader to be compiled. Punched card codes included no lower-case letters or many special characters, and special versions of the IBM 026 [[keypunch]] were offered that would correctly print the re-purposed special characters used in FORTRAN. Reflecting punched card input practice, Fortran programs were originally written in a fixed-column format, with the first 72 columns read into twelve 36-bit words. A letter "C" in column 1 caused the entire card to be treated as a comment and ignored by the compiler. Otherwise, the columns of the card were divided into four fields: * 1 to 5 were the label field: a sequence of digits here was taken as a label for use in DO or control statements such as GO TO and IF, or to identify a FORMAT statement referred to in a WRITE or READ statement. Leading zeros are ignored and 0 is not a valid label number. * 6 was a continuation field: a character other than a blank or a zero here caused the card to be taken as a continuation of the statement on the prior card. The continuation cards were usually numbered 1, 2, ''etc.'' and the starting card might therefore have zero in its continuation column—which is not a continuation of its preceding card. * 7 to 72 served as the statement field. * 73 to 80 were ignored (the IBM 704's [[IBM 711|card reader]] only used 72 columns).<ref>{{cite manual |url=http://www.bitsavers.org/pdf/ibm/7090/22-6528-4_7090Manual.pdf |archive-url=https://web.archive.org/web/20081201175757/http://bitsavers.org/pdf/ibm/7090/22-6528-4_7090Manual.pdf |archive-date=December 1, 2008 |url-status=live |title=Reference Manual, IBM 7090 Data Processing System |date=1961 |id=A22-6528-3}}</ref> Columns 73 to 80 could therefore be used for identification information, such as punching a sequence number or text, which could be used to re-order cards if a stack of cards was dropped; though in practice this was reserved for stable, production programs. An [[IBM 519]] could be used to copy a program deck and add sequence numbers. Some early compilers, e.g., the IBM 650's, had additional restrictions due to limitations on their card readers.<ref>{{cite manual |url= http://www.bitsavers.org/pdf/ibm/fortran/F28-8074-3_FORTRANII_GenInf.pdf |archive-url=https://web.archive.org/web/20050426055632/http://www.bitsavers.org/pdf/ibm/fortran/F28-8074-3_FORTRANII_GenInf.pdf |archive-date=April 26, 2005 |url-status=live |title=Fortran II General Information Manual |date=1963 |access-date=November 19, 2014 }}</ref> [[Keypunch]]es could be programmed to tab to column 7 and skip out after column 72. Later compilers relaxed most fixed-format restrictions, and the requirement was eliminated in the Fortran 90 standard. Within the statement field, [[whitespace character]]s (blanks) were ignored outside a text literal. This allowed omitting spaces between tokens for brevity or including spaces within identifiers for clarity. For example, {{code|AVG OF X}} was a valid identifier, equivalent to {{code|AVGOFX}}, and <syntaxhighlight lang="fortran" inline>101010DO101I=1,101</syntaxhighlight> was a valid statement, equivalent to <syntaxhighlight lang="fortranfixed" inline>10101 DO 101 I = 1, 101</syntaxhighlight> because the zero in column 6 is treated as if it were a space (!), while <syntaxhighlight lang="fortran" inline>101010DO101I=1.101</syntaxhighlight> was instead <syntaxhighlight lang="fortranfixed" inline>10101 DO101I = 1.101</syntaxhighlight>, the assignment of 1.101 to a variable called <syntaxhighlight lang="fortran" inline>DO101I</syntaxhighlight>. Note the slight visual difference between a comma and a period. [[Hollerith constant|Hollerith strings]], originally allowed only in FORMAT and DATA statements, were prefixed by a character count and the letter H (e.g., {{code|26HTHIS IS ALPHANUMERIC DATA.}}), allowing blanks to be retained within the character string. Miscounts were a problem.
Summary:
Please note that all contributions to Niidae Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Encyclopedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
Fortran
(section)
Add topic