LnSOS BOOT 1.1 SOS.KERNEL SOS KRNLI/O ERRORFILE 'SOS.KERNEL' NOT FOUND%INVALID KERNEL FILE: xةw,@  ȱlmi8#)!)JBACK4vs ' '+NEW13B.TEXT 0s c"+NEW13A.TEXT"(s 2+NEW11C.TEXT7)Psk: *NEW10.TEXT`%Hsk' +NEW13C.TEXTsl% +NEW11B.TEXTIII.PCL.18C3u' JBACK4s JREAD.ME.FIRST$ >dLԡm#i㰼m#iЕOLԡȱfg hi !dLԡ憦  Ljmkm l y`2 Lԡ8(Je稽)ʈ@L sc +NEW11A.TEXT,sk/ *NEW12.TEXT%Hsk; *LISTA.TEXTsa X W M D E F P H I J UY)V Y)AG^;_) | Nearest Whole | int(a+.5) a>=0 | 1 | ANINT | Real | Real |  | Number | int(a-.5) a<0 | | | | |  +------------------+------------------+------+--------+-----------+-----------+  | Neares | 1 | AINT | Real | Real |  | | See Note 1 | | | | |  +------------------+------------------+------+--------+-----------+-----------+ | Conversion | 1 | CHAR | Integer | Character |  | | to Character | | | | |  +------------------+------------------+------+--------+-----------+-----------+  | Truncation | int(a) | to Integer | | | | |  | | See Note 3 | | | | |  | +------------------+------+--------+-----------+-----------+  |  | | See Note 2 | | | | |  | +------------------+------+--------+-----------+-----------+  | | Conversion | 1 | ICHAR | Character | Integer |  | --------+  | | Conversion | 1 | REAL | Integer | Real |  | | to Real | | FLOAT | Integer | Real | al | Integer |  | | int(a) | | | | |  | | See Note 1 | | | | |  | +------------------+------+--------+-----------+---me | Argument | Function |  +------------------+------------------+------+--------+-----------+-----------+  | Type Conversion | Conversion | 1 | INT | Real | Integer |  | | to Integer | | IFIX | Re^bp 6@@TABLE OF INTRINSIC FUNCTIONS   +------------------+------------------+------+--------+-----------------------+  | Intrinsic | | No. | | Type of |  | Function | Definition | Args | Na  t Integer | int(a+.5) a>=0 | 1 | NINT | Real | Integer |  | | int(a-.5) a<0 | | | | |  +------------------+------------------+------+--------+-----------+-----------+  | Absolute Value | |a| | 1 | IABS | Integer | Integer |  | | | 1 | ABS | Real | Real |  +------------------+------------------+------+--------+-----------+-----------+  | Remaindering | a1-int( +------------------+------------------+------+--------+-----------+-----------+  | Arcsine | arcsin(a) | 1 | ASIN | Real | Real |  +------------------+------------------+------+--------+-----------+-----------+  | Arccos | 1 | COS | Real | Real |  +------------------+------------------+------+--------+-----------+-----------+  | Tangent | tan(a) | 1 | TAN | Real | Real | -+------------------+------+--------+-----------+-----------+  | Sine | sin(a) | 1 | SIN | Real | Real |  +------------------+------------------+------+--------+-----------+-----------+  | Cosine | cos(a) l Logarithm| log(a) | 1 | ALOG | Real | Real |  +------------------+------------------+------+--------+-----------+-----------+  | Common Logarithm | log10(a) | 1 | ALOG10 | Real | Real |  +----------------- +------------------+------------------+------+--------+-----------+-----------+  | Exponential | e**a | 1 | EXP | Real | Real |  +------------------+------------------+------+--------+-----------+-----------+  | Natura | | MIN1 | Real | Integer |  +------------------+------------------+------+--------+-----------+-----------+  | Square Root | a**0.5 | 1 | SQRT | Real | Real | | | | AMIN1 | Real | Real |  | | | +--------+-----------+-----------+  | | | | AMIN0 | Integer | Real |  | | | | | MAX1 | Real | Integer |  +------------------+------------------+------+--------+-----------+-----------+  | Choosing Small- | min(a1,a2,...) | >=2 | MIN0 | Integer | Integer |  | est Value  | Value | | | AMAX1 | Real | Real |  | | | +--------+-----------+-----------+  | | | | AMAX0 | Integer | Real |  | | Args.| Name | Argument | Function |  +------------------+------------------+------+--------+-----------+-----------+  | Choosing Largest | max(a1,a2,...) | >=2 | MAX0 | Integer | Integer | TABLE OF INTRINSIC FUNCTIONS - Continued  ----------------------------------------------------------------------------  | Intrinsic | | No. | | Type of |  | Function | Definition ve | a1-a2 if a1>a2 | 2 | IDIM | Integer | Integer |  | Difference | 0 if a1<=a2 | | DIM | Real | Real |  +------------------+------------------+------+--------+-----------+-----------+   ^bp      | Transfer of Sign | |a1| if a2>=0 | 2 | ISIGN | Integer | Integer |  | | -|a1| if a2<0 | | SIGN | Real | Real |  +------------------+------------------+------+--------+-----------+-----------+  | Positia1/a2)*a2 | 2 | MOD | Integer | Integer |  | | See Note 1 | | AMOD | Real | Real |  +------------------+------------------+------+--------+-----------+-----------+ ine | arccos(a) | 1 | ACOS | Real | Real |  +------------------+------------------+------+--------+-----------+-----------+  | Arctangent | arctan(a) | 1 | ATAN | Real | Real |  | +------------------+------+--------+-----------+-----------+  | | arctan(a1/a2) | 2 | ATAN2 | Real | Real |  +------------------+------------------+------+--------+-----------+-----------+  | Hyperbolic Sine | sinh(a) sequence; otherwise, it returns false. '  ^ne 2  LLE(a1,a2) returns true if a1 = a2 or if a1 precedes a2 in the ASCII  collating sequence; otherwise, it returns false. '  ^ne 2  LLT(a1,a2) returns true if a1 precedes a2 in the ASCII collating  se is true. '  ^ne 2  (4) LGE(a1,a2) returns the value true if a1 = a2 or if a1 follows a2  in the ASCII collating sequence; otherwise, it returns false. '  ^ne 2  LGT(a1,a2) returns true if a1 follows a2 in the ASCII collating value into an integer value. The  integer value of a character is the ASCII internal representation of  that character, and is in the range 0 to 127. For any two characters,  c1 and c2, (c1 .LE. c1) is true if and only if (ICHAR(c1) .LE.  ICHAR(c2))ess than a. IFIX(a) is the same as INT(a). "  ^ne 3  (2) For a of type integer, REAL(a) is as much precision of the  significant part of a as a real value can contain. FLOAT(a) is the  same as REAL(a). "  ^ne 2  (3) ICHAR converts a character The number of each of the notes that follow refers to the number in  column 2 of the Table.   ^ne 3  (1) For a of type real, if a >= 0 then int(a) is the largest integer  not greater than a, if a < 0 then int(a) in the most negative integer  not lFile(a) | 1 | EOF | Integer | Logical |  | | See Note 5 | | | | |  +------------------+------------------+------+--------+-----------+-----------+   | a1 < a2 | 2 | LLT | Character | Logical |  | Less Than | See Note 4 | | | | |  +------------------+------------------+------+--------+-----------+-----------+  | End of File | End_Of_lly Less | a1 <= a2 | 2 | LLE | Character | Logical |  | Than or Equal | See Note 4 | | | | |  +------------------+------------------+------+--------+-----------+-----------+  | Lexically  | Lexically | a1 > a2 | 2 | LGT | Character | Logical |  | Greater Than | See Note 4 | | | | |  +------------------+------------------+------+--------+-----------+-----------+  | Lexica= a2 | 2 | LGE | Character | Logical |  | Than or Equal | See Note 4 | | | | |  +------------------+------------------+------+--------+-----------+-----------+ | tanh(a) | 1 | TANH | Real | Real |  | Tangent | | | | | |  +------------------+------------------+------+--------+-----------+-----------+  | Lexically Greater| a1 >Intrinsic | | No. | | Type of |  | Function | Definition | Args.| Name | Argument | Function |  +------------------+------------------+------+--------+-----------+-----------+  | Hyperbolic  +------------------+------------------+------+--------+-----------+-----------+    ^bp     TABLE OF INTRINSIC FUNCTIONS - Continued   +------------------+------------------+------+--------+-----------+-----------+  | | 1 | SINH | Real | Real |  +------------------+------------------+------+--------+-----------+-----------+  | Hyperbolic Cosine| cosh(a) | 1 | COSH | Real | Real | quence; otherwise, it returns false. '  The operands or LGE, LGT, LLE, and LLT must be of the same length. '  ^ne 2  (5) EOF(a) returns the value true if the unit specified by its  argument is at or past the end of file record, otherwise it returns  false. The value of a must correspond to an open file, or to zero  which indicates the .CONSOLE device. %  (6) All angles are expressed in radians. "  ^ne 2  (7) All arguments in an intrinsic function reference must be of the  same type. " with any  other local name. The PROGRAM statement may only appear as the first  statement of a main program.    @@SUBROUTINES  A subroutine is a program unit that can be called from other program  units by a CALL statement. When called, it name that is the name of the main  program.   The name, pname, is a global name. Therefore, it cannot be the same  as another external procedure's name or a common block's name. It is  also a local name to the main program, and must not conflict always begins with the first executable statement in the main  program. Consequently, there must be one and only one main program in  every executable program. The form of a PROGRAM statement is:  %PROGRAM pname   where: pname is a user defined is any program unit that does not have a FUNCTION or  SUBROUTINE statement as its first statement. It may have a PROGRAM  statement as its first statement. The execution of a FORTRAN program ram, a subroutine, or a function program unit. The  term procedure is used to refer to either a function or a subroutine.  This chapter also describes the CALL and RETURN statements as well as  function calls.    @@MAIN PROGRAMS  A main programf Intrinsic Functions  105 Statement Functions  106 RETURN Statementi  106 Parameters     ^bp .  .  @@INTRODUCTION  This chapter describes the format of program units. A program unit is  either a main prog   @@CHAPTER 13    @@@PROGRAM UNITS    98 Introduction  98 Main Programs  98 Subroutines  99 SUBROUTINE Statement  99 CALL Statement  100 Functions  100 External Functions  101 Intrinsic Functions  102 Table o!#$%&'()*+,-./012345G^۞ՠ " performs the set of  actions defined by its executable statements, and then returns control  to the statement immediately following the statement that called it.  A subroutine does not directly return a value, although values can be  passed back to the calling program unit via parameters or common  variables.   ^ne 5  @SUBROUTINE STATEMENT ^zz  A subroutine begins with a SUBROUTINE statement and ends with the  first following END statement. It may contain any kind of statof actual arguments must be the same as in the definition of  the function, and the corresponding types must agree.  ^ne 5  @EXTERNAL FUNCTIONS ^zz  An external function is specified by a function program unit. It  begins with a FUNCTION statemen ^ne 6 %fname ( [arg [,arg]...] )   where: fname is the name of an external, intrinsic, or statement  function.  'arg is an actual argument.   ^ne 3  An actual argument may be an arithmetic expression or an array. The  number  A function reference may appear in an arithmetic expression.  Execution of a function reference causes the function to be evaluated,  and the resulting value is used as an operand in the containing  expression. The form of a function reference is:  value that is  used in the computation of that expression. There are three kinds of  functions: external functions, intrinsic functions, and statement  functions. This section describes the three kinds of functions.   ^ne 2 cannot call itself directly, nor can it call another  subroutine that will result in that subroutine being called again  before it returns control to its caller.     ^ne 4  @@FUNCTIONS  A function is referenced in an expression and returns aent in that  subroutine.   ^ne 2  A subroutine specified in any program unit may be called from any  other program unit within the same executable program. Recursive  subroutine calls, however, are not allowed in FORTRAN. That is, a  subroutine with their corresponding formal arguments, and the body of the  specified subroutine is executed. Control is returned to the  statement following the CALL statement upon exiting the subroutine, by  executing either a RETURN statement or an END statement may be used as an actual  argument in another subprogram call.   ^ne 2  Execution of a CALL statement proceeds as follows: All arguments that  are expressions are evaluated. All actual arguments are associated there are no  arguments in the SUBROUTINE statement, then a CALL statement  referencing that subroutine must not have any actual arguments, but  may optionally have a pair of parentheses following the name of the  subroutine. Note that a formal argumal argument may be either an expression or the name of an  array. The actual arguments in the CALL statement must agree in type  and number with the corresponding formal arguments specified in the  SUBROUTINE statement of the referenced subroutine. If statement in another program unit that references that subroutine.  The form of a CALL statement is:  ^ne 5 %CALL sname [( [arg [,arg]... ] )]   where: sname is the name of a subroutine. '  arg is an actual argument.   ^ne 2  An actuents to that subroutine. Argument names cannot appear in  COMMON, DATA, EQUIVALENCE, or INTRINSIC statements.   ^ne 6  @CALL STATEMENT ^zz  A subroutine is executed as a consequence of executing a CALL of a formal argument.   ^ne 2  The name, sname, is a global name, but it is also local to the  subroutine it names. The list of argument names defines the number  and, with any subsequent IMPLICIT, type, or DIMENSION statements, the  type of argumement  other than a PROGRAM statement or a FUNCTION statement. The form of  a SUBROUTINE statement is:  ^ne 5 %SUBROUTINE sname [( [farg [, farg]...] )]   where: sname is the user defined name of the subroutine.  'farg is a user defined namet and ends with an END statement. It  may contain any kind of statement other that a PROGRAM statement, a  FUNCTION statement, or a SUBROUTINE statement. The form of a FUNCTION  statement is:  ^ne 7 %[type] FUNCTION fname ( [farg [, farg]...] )   where: type is one of INTEGER, REAL, or LOGICAL.  'fname is the user defined name of the function. ' 'farg is a formal argument name.   ^ne 2  The name, fname, is a global name, and it is also local to the  function it names. If no type689:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^G^zG not  allowed.   tandard type of that intrinsic  function.   ^ne 2  Arguments to certain intrinsic functions are limited by the definition  of the function being computed. For example, the logarithm of a  negative number is mathematically undefined, and therefore  ^ne 2  An intrinsic function name may appear in an INTRINSIC statement, but  only those intrinsic functions listed in the table may do so. An  intrinsic function name also may appear in a TYPE statement, but only  if the type is the same as the sctions available in Apple  FORTRAN 77. An IMPLICIT statement does not alter the type of an  intrinsic function. For those intrinsic functions that allow several  types of arguments, all arguments in a single reference must be of the  same type. IONS ^zz  Intrinsic functions are functions that are predefined by the FORTRAN  compiler and are available for use in a FORTRAN program. The table  following this section gives the name, definition, number of  parameters, and type of the intrinsic funthis variable can be  referenced in an expression, exactly like any other variable. An  external function may return values in addition to the value of the  function by assignment to one or more of its formal arguments.   ^ne 5  @INTRINSIC FUNCT defining the function. Every execution of that function must assign a  value to that variable. The final value of this variable, upon  execution of a RETURN or an END statement, defines the value of the  function. After being defined, the value of e.  Neither argument names nor fname can appear in COMMON, DATA,  EQUIVALENCE, or INTRINSIC statements.   ^ne 2  The function name must appear as a variable in the program unit any additional type statements. In any event, an  external function cannot be of type character. The list of argument  names defines the number and, with any subsequent IMPLICIT, type, or  DIMENSION statements, the type of arguments to that subroutin is present in the FUNCTION statement,  the function's type is determined by default and any subsequent  IMPLICIT or type statements that would determine the type of an  ordinary variable. If a type is present, then the function name  cannot appear in That is, i is an integer variable and e1, e2, and e3 are integer  expressions. In a READ statement, the DO variable i or any associated  entity must not appear as an input list item in the embedded iolist,  but may have been read in the same READ staements and are of the form: % %(iolist, i = e1, e2 [, e3])   where the iolist is as above, including nested implied DO lists, and  i, e1, e2 and the optional e3 are as defined for the DO statement. e  array in storage sequence order. %  ^ne 2  * Any other expression not beginning with the character '(' to  distinguish implied DO lists from expressions. %  ^ne 7  Implied DO lists may be specified as items in the iolist of READ and  WRITE statuence order.  ^ne 2  An output entity may be specified in the iolist of a WRITE statement  and is of one of these forms: %  * Variable name. %  * Array element name. %  ^ne 2  * Array name: This is a means of specifying all of the elements of th An input entity may be specified in the I/0 list of a READ statement  and is of one of these forms:   * Variable name %  * Array element name %  ^ne 2  * Array name which is a means of specifying all of the elements of the  array in storage seqties whose values  are transferred by READ and WRITE statements. An iolist is a comma-  separated list of items which consist of:   * Input or Output entities %  * Implied DO lists   ^ne 2 bel which that  integer variable has been assigned to using the ASSIGN statement. %  ^ne 2  * A character expression that is specified as the current value of the  character expression. %  ^ne 3  The input-output list, or iolist, specifies the entitum. %  ^ne 2  The format specifier, f, can take one of these forms in an I/O  statement:   ^ne 2  * A statement label that refers to the FORMAT statement labeled by  that label. %  ^ne 2  * An integer variable name that refers to the FORMAT la * An integer expression refers to external file with unit number equal  to the value of the expression (* is unit number 0). %  ^ne 2  * A name of a character variable or character array element refers to  the internal file which is the character daused in  the descriptions of the statements and explained below.   ^ne 2  The unit specifier, u, can take one of these forms in an I/O  statement: %  * An asterisk (*) refers to the .CONSOLE. %  ^ne 2 f  describing these statements.   ^ne 2  The various I/O statements use certain parameters and arguments which  specify sources and destinations of data transfer, as well as other  facets of the I/O operation. The abbreviations for these are al value indicating whether the file associated with  the unit specifier passed to it is at end of file. A familiarity with  the FORTRAN file system, units, records, and access methods as  described in the previous sections is assumed for the purpose o    ^ne 5  @@I/O STATEMENTS  I/O statements that are available from FORTRAN are as follows: OPEN,  CLOSE, READ, WRITE, BACKSPACE, ENDFILE, and REWIND.   ^ne 2  In addition, there is an I/O intrinsic function called EOF that  returns a logictement outside of the  implied DO list. The embedded iolist is effectively repeated for each  iteration of i with appropriate substitution of values for the DO  variable i.   ^ne 2  The following I/O statements are supported in the FORTRAN system. The  possible form for each statement is specified first, with an  explanation of the meanings for the forms following. Certain items are  specified as required if they must appear in the statement and are  specified as optional if they need not appThe ",PRINT" option designates an output file as a "print" file so that  the first character in each record is replaced by a print control  character or a blank character. As a result the program can write a  "print" file to a disk and later transfe an existing file created by the editor called DATA3.TEXT %C as unit #3 +OPEN(3,FILE='DATA3.TEXT') ^ne 4 Example program fragment 3: %C Open a new "print" file named "XXX" as unit #6 +OPEN(6,FILE='XXX',PRINT,STATUS='NEW') ,'(A)') FNAME %C Open the file as formatted sequential as unit 7, note that the %C ACCESS specified need not have appeared since it is the default. +OPEN(7,FILE=FNAME,ACCESS='SEQUENTIAL',STATUS='NEW'); +  ^ne 4  Example program fragment 2: %C Open.PRINTER') where X is an integer. ^ne 9  Example program fragment 1: %C Prompt user for a file name +WRITE(*,'(A$)') 'Specify output file name - ' %C Presume that FNAME is specified to be CHARACTER*23 %C Read the file name from the .CONSOLE +READ(* that file.   ^ne 2 Note that STATUS='OLD' is the default. To open a new file, you must  specify STATUS='NEW' in the OPEN statement.   ^ne 4  If a file is to be written to a printer, the format of the OPEN  statement must be:   OPEN(X,FILE='ich it is required. A  ^ne 2  The OPEN statement binds a unit number with an external device or file  on an external device by specifying its file name. If the file is to  be direct, the RECL=rl option specifies the length of the records in ~~~~~,RECL=rl) ~~~~~~~~~~~~~~~~~~The record length rl (in bytes) is an ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~integer expression. This argument to ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~OPEN is for direct access files only, ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~for wh~~~~~~~~~~~~~"print" file. This argument to OPEN ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~preserves the desired effects of the ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~print control characters that are located ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~in the first column.  ,'NEW' For writing new files. % %,ACCESS='SEQUENTIAL' or Default. ,'DIRECT' % %,FORM='FORMATTED' or Default. *'UNFORMATED' ^tr ~ ~~~~~,PRINT~~~~~~~~~~~~~~~~~~~~~~Designates the file named "fname" as a ~~~~~~~~~~~~~~~~~~~~ optional and may appear in any order.  The options are character constants with optional trailing blanks  except RECL=. Defaults are indicated. A %,STATUS='OLD' or Default, for reading or writing Aexisting files. r Aexpression. If no name is specified, Athe name "UNIT....u" will be used Awhere "u" is the unit number. This Afile will be DIRECT and UNFORMATTED Aunless other parameters specify Adifferently.   ^ne 18  The following arguments are all][,ACCESS=' '][,STATUS=' '][,FORM=' '] [,PRINT][,RECL=rl])   OPEN(u Required, must appear as the first Aargument. Must not be internal unit Aspecifier. % $,FILE=fname The file name, fname, is a characte required if the bracketed parameters are used. The single quotes  within the brackets are likewise required if the optional parameter is  used. Lower case items in the statement descriptions are explained.   ^ne 13  @OPEN ^zz OPEN(u[,FILE=fnameear. The defaults are  indicated for optional items. All punctuation marks, parentheses, and  the like must be entered exactly as shown. Optional parameters and  other items are enclosed in brakets [ ]. Commas within brackets are r the disk file to a printer  with all the print control in effect. FORTRAN reserves the first column in a line for printer control. The  printer control characters are also called "carriage control" characters because they effect vertical spacing. The characters are not printed and have the following effects: ^ul 'Character Vertical Spacing Before Printing the Line blank advance one line ( 0 advance two lines 1 Aaccess file, writing continues at Athe current position in the file. A &)iolist Note parentheses after last parameter Aand immediately before iolist. %  ^ne 2  The WRITE statement transfers the iolist items to the unit specifiecond argument, must not appear for Aunformatted write. & % ,REC=rn For direct access only, otherwise Aerror. Positions to record number Arn, where rn is a positive integer Aexpression. If omitted for direct ,((IA(I,J),J=1,J),I=1,I,1) %990 FORMAT(2I5/,(8I5))    ^ne 20  @WRITE  ^zz  WRITE(u[,f][,REC=rn])iolist   WRITE(u Required, must be first argument. % % ,f Required for formatted write as Asmensional array for the example +DIMENSION IA(10,20) %C Read in bounds for array off first line, hopefully less than %C 10 and 20. Then read in the array in nested implied DO lists %C with input format of 8 columns of width 5 each. +READ(3,990)I,J file or error condition occurs. If the read is internal, the character  variable or character array element specified is the source of the  input, otherwise the external unit is the source.   ^ne 9  Example program fragment:  %C Need a two diabove. Note closing @parentheses follows last of above @parameters and immediately precedes the % iolist. %  ^ne 2  The READ statement sets the items in iolist, assuming that no end of @a run time error. If present, @encountering an end of file condition @results in the transfer to the @executable statement labeled s which @must be in the same program unit as the @READ statement. % %iolist See description eger expression. If @omitted for direct access file, reading @continues from the current position in @the file. % %,END=s) Optional, statement label. If not % present, reading end of file results in %,f Required for formatted read as second @argument, must not appear for @unformatted read. % %,REC=rn For direct access only, otherwise error. @Positions to record number rn, where rn @is a positive intfragment:  %C Close the file opened in OPEN example, discarding the file +CLOSE(7,STATUS='DELETE')    ^ne 26  @READ  ^zz  READ(u[,f][,REC=rn][,END=s])iolist   READ(u Required, must be first argument. % ATUS='DELETE' is specified. Normal  termination of a FORTRAN program automatically closes all open files  as if CLOSE with STATUS='KEEP' had been specified. It is generally  safer, however, to explicitly CLOSE all files.   ^ne 4  Example program  ^ne 2  CLOSE disconnects the unit specified and prevents subsequent I/O from  being directed to that unit unless the same unit number is reopened,  possibly bound to a different file or device. Files opened NEW are  temporaries and discarded if ST& argument. Must not be internal unit Aspecifier. & &,STATUS='KEEP') Optional argument which applies only &,STATUS='DELETE') to files opened NEW, default is KEEP. AThe option is character constant.  advance to first line of next page + no advance  ^ne 12  @CLOSE  ^zz  CLOSE(u[,STATUS=' '])   CLOSE(u Required. Must appear as the first ed.  If the write is internal, the character variable or character array  element specified is the destination of the output, otherwise the  external unit is the destination.   ^ne 6  Example program fragment:  %C Place message: "One = 1, Two = 2, Three = 3" on the .CONSOLE %C not doing things in the simplest way! +WRITE(*,980)'One =',1,1+1,'ee = ',+(1+1+1) %980 FORMAT(A,I2,', Two =',1X,I1,', Thr',A,I1)    ^ne 6  @BACKSPACE  ^zz  BACKSPACE u Unit is not intern FORTRAN, the preconnected unit * is connected to the .CONSOLE device,  for reading and writing to the user of the system when a FORTRAN  program is executing. Reading from this unit will continue until  terminated by a RETURN character (ASCII CR, decANSI  FORTRAN specifies that devices may be preconnected without an OPEN  statement, and that one such device may be given the special unit  number 0 and may also be referred to with the character *. In Apple e character, decimal code 32) to satisfy multiple read  operations until the next record is explicitly called for.   ^ne 2  For convenient interaction with the console, you will find that  several features have been included in the FORTRAN system. ng to prompt on one line and  take user input from the next one. This also gives you the ability to  read and write formatted files in units smaller than one record. On  input, formatted records are almost infinitely extended with blanks  (ASCII spac control inhibits advancing to the next record when the next record is  also the last format control executed in a READ or WRITE operation.  This allows interactive prompting and reading from the console on the  same line of the screen instead of havim access to the files.   ^ne 2  3. Since the Apple system is interactive, it is sometimes desirable to  be able to write or read partial records in formatted READ and WRITE  statements. In order to accomplish this, the dollar sign format ess files must be connected to blocked devices such as  disk drives, since only these devices can implement random access.   ^ne 2  * The BACKSPACE operation is only supported when using files connected  to blocked devices, since it depends on randontial files and unformatted direct (random access)  files. As in the full ANSI Standard FORTRAN 77, Apple FORTRAN has all  combinations of formatted, unformatted, sequential, and direct access  files, with these restrictions:   ^ne 2  * Direct acc   ^ne 5  @@NOTES ON I/O OPERATIONS  1. Any function referenced in an expression within an I/O statement  cannot cause any I/O statement to be executed.   ^ne 2  2. The ANSI Standard subset FORTRAN 77 language includes only  formatted sequeEWIND  ^zz  REWIND u Unit is not an internal unit  specifier.   Execution of a REWIND statement causes the file associated with the  specified unit to be positioned at its initial point.  ord. This prohibits any further sequential  data transfer until either a BACKSPACE or REWIND is executed. If an  ENDFILE is written on a direct access file, all records written beyond  the position of the new end of file disappear.    ^ne 8  @R Unit is not an internal unit  specifier.  ^ne 2  ENDFILE writes an end of file record as the next record of the file  that is connected to the specified unit. The file is then positioned  after the end of file rec changed if there is no preceding record. If the preceding record is  the endfile record, however, the file becomes positioned before the endfile record. UCSD files can not be backspaced.    ^ne 5  @ENDFILE ^zz  ENDFILE u al unit specifier. AOnly useable with blocked devices.   ^ne 2  BACKSPACE causes the file connected to the specified unit to be  positioned before the preceding record. The file position is not imal 13). In addition,  this unit supports the backspace key (ASCII DEL, decimal 127) to  delete one character at a time as well as the line rubout key (ASCII  DLE, decimal 16) to delete the entire line entered since the last  RETURN.   ^ne 2  The preconnected unit feature in conjunction with the end of record  inhibitor $ for writing on the .CONSOLE, the infinite blank extension,  and the standard BN format control option allow for very convenient  interaction. Here's an example of one-line pG^۞4?tted I/O procedures in execution time and in file-space required. Data bases that will be reread by FORTRAN should usually be written as unformatted files.  ^bp meanings when treated as ASCII characters, are passed directly through the I/O system. Thus, instrument control or monitoring applications can be programmed in a straightforward manner. Unformatted I/O is also quite a bit more efficient than the formated by the system, and with no character interpretation done at the system level. Patterns such as those that correspond to characters with values 13 (RETURN on the keyboard) and 16 (DLE), which ordinarily have special FORMAT(A) (OPEN(3,FILE=FNAME)   ^ne 2 Unformatted files used with unblocked devices are ideal for control of I/O devices which require or produce arbitrary bit-patterns. The files are "pure" to FORTRAN, with no end-of-record marks provided or expecerating system filename. The following program fragment prompts for  a filename to be used as an input file to be connected to unit 3:   ^ne 6 (CHARACTER*23 FNAME (WRITE(*,920)'File name for input:'  920 FORMAT(A$) (READ(*,930)FNAME  930  in a READ or WRITE statement because only the unit number associated  to it will appear there.   ^ne 2  4. To make interactive access to the Pascal operating system file  manager possible, the OPEN statement contains a reference to a Pascal  oppear in OPEN  statements because it is preconnected. The volume * can and does  appear in OPEN statements where it can be a part of a complete file  name specification. The * boot disk volume name will never appear  specify the volume name of the system or boot disk. There is no  real ambiguity here, because the context of these two usages is  different. The unit * always means the .CONSOLE when it appears in  READ and WRITE statements; the unit * will never apwo columns to satisfy the I5,  and the BN edit control right-justifies the 123 input in the edit  field.   ^ne 3  &HAND Don't confuse the use of the * in FORTRAN I/O statements with  the use of the same character by the Pascal operating system to  first WRITE statement and the cursor is left one space beyond the word  'integer:'. If the program user then typed the digits 123 and then  pressed RETURN, it would be interpreted as the number 123, since the  record is automatically blank-extended trompting:   ^ne 4 &WRITE(*,900)'Input a five digit integer: '  900 FORMAT(A$) &READ(*,910)I  910 FORMAT(BN,I5)   ^ne 2  This example prompts without a terminating carriage return after the _abcdefghijklmnopqrstuvwxyz{|}~found in the same program unit as the  assigned GOTO statement. The same statement label may appear  repeatedly in the list of labels. When the assigned GOTO statement is  executed, i must have been assigned the label of an executable  statement thatond, or Xth, label in the s list.   ^ne 9  @@ASSIGNED GOTO  The format for an assigned GOTO statement is:  %GOTO i [[,] (s [, s] ...)] %  where i is an integer variable name and each s is a statement label of  an executable statement that is  the list of labels. It is illegal to jump into a DO, IF, ELSEIF, or  ELSE block from outside the block.  ^ne 6  Here is an example:   GOTO(1,2,3,4)X   If X=2, the program will branch to the line labeled 2 since 2 happens  to be the sec there are n labels  in the list of labels. If i < 1 or i > n then the computed GOTO  statement acts as if it were a CONTINUE statement, otherwise, the next  statement executed will be the statement labeled by the ith label in  executable statement that is found in the same program unit as the  computed GOTO statement. The same statement label may appear  repeatedly in the list of labels. The effect of the computed GOTO  statement can be explained as follows: Suppose thatwed to GOTO into a DO, IF,  ELSEIF, or ELSE block from outside the block.    @@COMPUTED GOTO  The format for a computed GOTO statement is:  %GOTO (s [, s] ...) [,] i %  where i is an integer expression and each s is a statement label of an  where s is a statement label number of an executable statement that is  found in the same program unit as the GOTO statement. The effect of  executing a GOTO statement is that the next statement executed is the  statement labeled s. You are not allore the CALL statement and the RETURN statement, both of  which are described in Chapter 13.    @@UNCONDITIONAL GOTO  The format for an unconditional GOTO statement is: % %GOTO s % DITIONAL GOTO, COMPUTED GOTO, ASSIGNED GOTO,  ARITHMETIC IF, LOGICAL IF, BLOCK IF...THEN...ELSE, BLOCK IF, ELSEIF,  ELSE, ENDIF, DO, CONTINUE, STOP, PAUSE, and END. %  The two remaining statements which control the order of execution of  statements aNDIF !70 DO !71 CONTINUE !72 STOP !72 PAUSE !72 END   ^bp     @@INTRODUCTION   Control statements are used to control the order of execution of  statements in a FORTRAN program. This chapter describes the control  statements UNCON    @@CHAPTER 10    @@@CONTROL STATEMENTS   !64 Introduction !64 Unconditional GOTO !64 Computed GOTO !65 Assigned GOTO !65 Arithmetic IF !66 Logical IF !66 Block IF...THEN...ELSE !68 Block IF !69 ELSEIF !69 ELSE !69 E is found in the same program unit as the assigned GOTO  statement. The effect of the statement is that the next statement  executed will be the statement labeled by the label last assigned to  i. If the optional list of labels is present, a runtime error is  generated if the label last assigned to i is not among those listed.  It is illegal to jump into a DO, IF, ELSEIF, or ELSE block from  outside the block.   ^ne 6  Example:   y if I.LT.100 *. &ELSEIF(I.LT.1000)THEN (. ). Some statements executed only if I.GE.100 and I.LT.1000 *. 0IF(J.LT.10)THEN 0. 1. Some statements executed only if I.GE.100 and I.LT.1000 2. and J.LT.10 0ENDIF (. ). Some statements executed onle indentation is solely to enhance readability.  &IF(I.LT.100)THEN (. ). Some statements executed only if I.LT.100 *. 0IF(J.LT.10)THEN 2. 3. Some statements executed only if I.LT.100 and J.LT.10 4. 0ENDIF (. ). Some statements executed onl). Some statements executed only if none of above conditions *. were true &ENDIF   ^ne 29  Skeleton 3 - Illustrates that the constructs can be nested. (Also, an  ELSE statement can follow a block IF without intervening ELSEIF  statements.) Th *. &ELSEIF(J.GT.100)THEN (. ). Some statements executed only if J.GT.100 and J.LE.1000 *. &ELSEIF(J.GT.10)THEN (. ). Some statements executed only if J.GT.10 and J.LE.1000 *. and J.LE.100 &ELSE (. he  expression is false:  &IF(I.LT.10)THEN (. ). Some statements executed only if I.LT.10 *. &ENDIF   ^ne 19  Skeleton 2 - Block IF with a series of ELSEIF statements:  &IF(J.GT.1000)THEN (. ). Some statements executed only if J.GT.1000he readability of FORTRAN programs and  to cut down the number of GOTOs. As an overview of these sections, the  following three code skeletons illustrate the basic concepts:  ^ne 8  Skeleton 1 - Simple Block IF which skips a group of statements if t statement had been encountered.    ^ne 5  @@BLOCK IF...THEN...ELSE  The following sections describe the block IF statement and the various  related statements. These statements are new to FORTRAN 77 and can be  used to dramatically improve tn to be evaluated  and, if the value of that expression is true, then the statement, st,  is executed. Should the expression evaluate to false, the statement st  is not executed and the execution sequence continues as if a CONTINUE e format for a logical IF statement is:  %IF (e) st %  where e is a logical expression and st is any executable statement  except a DO, block IF, ELSEIF, ELSE, ENDIF, END, or another logical IF  statement. The statement causes the logical expressio200,300   ^ne 3  If I evaluates to a negative number, the branch will be to the  statement labeled 100. If I is 0, it will be to 200. If I is a  positive number , the branch will be to the statement labeled 300.    ^ne 9  @@LOGICAL IF  Th selected if the value of e exceeds 0. The next statement executed will  be the statement labeled by the selected label. It is illegal to jump  into a DO, IF, ELSEIF, or ELSE block from outside the block.   ^ne 3  Example:   IF (I) 100,abels. The effect of the  statement is to evaluate the expression and then select a label based  on the value of the expression. Label s1 is selected if the value of e  is less than 0, s2 is selected if the value of e equals 0, and s3 is %  where e is an integer or real expression and each of s1, s2, and s3  are statement labels of executable statements found in the same  program unit as the arithmetic IF statement. The same statement label  may appear more than once among the three l GOTO TARGET   If TARGET, which is a variable name in this example, = 100, the  statement causes a branch to the statement with the label 100.    ^ne 9  @@ARITHMETIC IF  The format for an arithmetic IF statement is:  %IF (e) s1, s2, s3 y if I.GE.100 and I.LT.1000 *. &ENDIF &   ^ne 8  In order to understand, in detail, the block IF and associated  statements, the concept of an IF-level is necessary. For any  statement, its IF-level is % %n1 - n2 %  where n1 is the number of block IF statements from the beginning of  the program unit that the statement is in up to and including that  statement, and n2 is is the number of ENDIF statements from the  beginning of the program unit) up to, but not inc statement consists of all of  the executable statements, possibly none, that follow the ELSE  statement up to, but not including, the next ENDIF statement that has  the same IF-level as this ELSE statement. The matching ENDIF statement  must appear be same IF-level as the  ELSEIF statement. Note that transfer of control into an ELSEIF block  from outside that block is not allowed.     ^ne 9  @@ELSE  The format of an ELSE statement is:  %ELSE %  The ELSE block associated with an ELSE executable statements, the next statement executed is the next ENDIF  statement at the same IF level as the ELSEIF statement. If the  expression evaluates to false, the next statement executed is the next  ELSEIF, ELSE, or ENDIF statement that has th the last statement in the ELSEIF block, the  next statement to be executed will be the next ENDIF statement at the  same IF-level as this ELSEIF statement. If the expression in this  ELSEIF statement evaluates to true and the ELSEIF block has no execution of an ELSEIF  statement begins by evaluating the expression. If its value is true  and there is at least one statement in the ELSEIF block, the next  statement executed is the first statement of the ELSEIF block.  Following the execution ofed with an  ELSEIF statement consists of all of the executable statements,  possibly none, that follow the ELSEIF statement up to, but not  including, the next ELSEIF, ELSE, or ENDIF statement that has the same  IF-level as this ELSEIF statement. The  statement. Note that transfer of control into an IF block from outside  that block is not allowed.    ^ne 9  @@ELSEIF  The format of an ELSEIF statement is:  %ELSEIF (e) THEN %  where e is a logical expression. The ELSEIF block associattatement at  the same IF level as the block IF statement. If the expression  evaluates to false, the next statement executed is the next ELSEIF,  ELSE, or ENDIF statement that has the same IF-level as the block IF executed will be the next ENDIF statement at the same  IF-level as this block IF statement. If the expression in this block  IF statement evaluates to true and the IF block has no executable  statements, the next statement executed is the next ENDIF sis evaluated. If it evaluates to  true and there is at least one statement in the IF block, the next  statement executed is the first statement of the IF block. Following  the execution of the last statement in the IF block, the next  statement to be including, the next ELSEIF, ELSE, or ENDIF statement that has the same  IF-level as this block IF statement. The IF-level defines the notion  of matching ELSEIF, ELSE, or ENDIF. The effect of executing the block  IF statement is that the expression e e is a logical expression. The IF block associated with this  block IF statement consists of all of the executable statements,  possibly none, that appear following this statement up to, but not ill be used to define the nesting rules for  the block IF and associated statements and to define the extent of IF  blocks, ELSEIF blocks, and ELSE blocks.    ^ne 9  @@BLOCK IF  The format for a block IF statement is:  %IF (e) THEN %  wherluding, that  statement. The IF-level of every statement must be greater than or  equal to 0 and the IF-level of every block IF, ELSEIF, ELSE, and ENDIF  must be greater than 0. Finally, the IF-level of every END statement  must be 0. The IF-level wefore any intervening ELSE or ELSEIF statements of the  same IF-level. There is no effect in executing an ELSE statement. Note  that transfer of control into an ELSE block from outside that block is  not allowed.     ^ne 6  @@ENDIF  The format of an ENDIF statement is:  %ENDIF %  ^ne 2  There is no effect in executing an ENDIF statement. An ENDIF statement  is required to match every block IF statement in a program unit in  order to specify which statements are in a particued with execution of a CONTINUE statement.  The primary use for the CONTINUE statement is as a convenient  statement to label, particularly as the terminal statement in a DO  loop.   ^ne 8  Here's an example of the CONTINUE statement in action:  %C This program fragment prints the number 1 to 11 on the CONSOLE: +DO 200 I=1,10 %200 WRITE(*,'(I5)')I +WRITE(*,'(I5)')I   ^ne 6  @@CONTINUE  The format of a CONTINUE statement is:  %CONTINUE %  ^ne 2  There is no effect associat The value of the DO variable is well defined regardless of whether the  DO loop exits as a result of the iteration count becoming zero or as a  result of a transfer of control out of the DO loop.   ^ne 6  Example of final value of DO variable:  atement (was executed. ' %2. The iteration count is decremented by one.   ^ne 2 %3. The iteration count is tested, and if it exceeds zero, the  statements in the range of the DO loop are executed again. %  ^ne 2 are executed.   ^ne 2  Following the execution of the terminal statement of a DO loop, the  following steps occur in order:   ^ne 3  1. The value of the DO variable, i, is incremented by the % value of e3 which was computed when the DO stbe *MAX0(((e2 - e1 + e3)/e3),0) (which may be zero (Note: unlike FORTRAN 66) if either * *e1 > e2 and e3 > 0 1or *e1 < e2 and e3 < 0.   ^ne 2 %4. The iteration count is tested, and if it exceeds zero, the (statements in the range of the DO loop %1. The expressions e1, e2, and e3 are evaluated. If e3 is not (present, it is as if e3 evaluated to 1; e3 must not evaluate (to 0.  %2. The DO variable, i, is set to the value of e1.   ^ne 7 %3. The iteration count for the loop is computed to associated  with it. It is not allowed to jump into the range of a DO loop from  outside its range.   ^ne 2  The execution of a DO statement causes the following steps to happen  in order:   ^ne 3 the particular block. If a block IF statement appears  within the range of a DO loop, its associated ENDIF statement must  also appear within the range of that DO loop. The DO variable, i, may  not be set by the program within the range of the DO loopy contained within the range  of the enclosing DO loop, although the loops may share a terminal  statement. If a DO statement appears within an IF block, ELSEIF block,  or ELSE block, the range of the associated DO loop must be entirely  contained in  A DO loop is said to have a range, beginning with the statement which  follows the DO statement and ending immediately after the terminal  statement of the DO loop. If a DO statement appears in the range of  another DO loop, its range must be entirelck IF, ELSEIF, ELSE, ENDIF,  RETURN, STOP, END, or DO statement. If the terminal statement is a  logical IF, it may contain any executable statement EXCEPT those not  permitted inside a logical IF statement. %  ^ne 2  unit. In the DO statement, i is an integer variable, and e1, e2, and  e3 are integer expressions. The statement labeled by s is called the  terminal statement of the DO loop. It must not be an unconditional  GOTO, assigned GOTO, arithmetic IF, blolar block IF  statement.    ^ne 9  @@DO  The format of a DO statement is:  %DO s [,] i=e1, e2 [, e3] %  where s is a statement label of an executable statement. The label  must follow this DO statement and be contained in the same program  C EXAMPLE OF CONTINUE STATEMENT &DO 200 I=1,10 &WRITE(*,'(I5)')I  200 CONTINUE &WRITE(*,'(I5)')I &END   ^ne 2  Note that CONTINUE simply acts as the terminator statement for the DO  loop in the routine.     ^ne 9  @@STOP  The format of a STOP statement is:  %STOP [n] %  where n is either a character constant or a string of not more than 5  digits. The effect of executing a STOP statement is to cause the  program to terminate. The argument, n, if present, is displ   ^ne 5  @STATEMENT FUNCTIONS ^zz  A statement function is a function that is defined by a single  statement. It is similar in form to an assignment statement. A  statement function statement can only appear after the specification  statementsG^۞˦Mrogram unit.  ^bp  ^ne 2 The effect of executing the END statement in a subprogram is the same as execution of a RETURN statement and the effect in the main program is to terminate execution of the program. The END statement must appear as the last statement in every pcontents of n, if present, are displayed as  part of the prompt requesting input. When input is received, execution  resumes as if a CONTINUE statement had been executed.    ^ne 6  @@END  The format of an END statement is:  %END % %PAUSE [n] %  where n is either a character constant or a string of not more than 5  digits. The effect of executing a PAUSE statement is to cause the  program to PAUSE until input is received from the keyboard. Execution  will then continue. The ayed on the  CONSOLE: upon termination.   ^ne 4  Example: STOP 'DONE!'   The message DONE! will be displayed on the screen when the program  executes the STOP statement.     ^ne 9  @@PAUSE  The format of a PAUSE statement is:  and before any executable statements in the program unit in  which it appears. A statement function is not an executable statement;  since it is not executed in order as the first statement in its  particular program unit. Rather, the body of a statement function  serves to define the meaning of the statement function. It is  executed, as any other function, by the execution of a function  reference. The form of a statement function is:  ^ne 7  fname ( [arg [, arg]...] ) = expr   wher associated with the formal arguments, much as an EQUIVALENCE statement  associates two or more arrays or variables, and COMMON statements in  two or more program units associate lists of variables. This  association remains in effect until execution in common can be used to perform this task as well. The  number of actual arguments must be the same as formal arguments, and  the corresponding types must agree.   ^ne 2  Upon entry to a subroutine or function, the actual arguments become broutine, and an actual argument is the specific variable,  expression, array, and so forth, passed to the procedure in question  at any specific calling location.   ^ne 2  Arguments are used to pass values into and out of procedures.  Variables atement.     ^ne 5  @@PARAMETERS  This section discusses the relationship between formal and actual  arguments in a function or subroutine call. A formal argument refers  to the name by which the argument is known within the function or  su function, then the value of that function is equal to the current  value of the variable with the same name as the function. Execution of  an END statement in a function or subroutine is treated in exactly the  same way as is execution of a RETURN st The form of a  RETURN statement is:  %RETURN   ^ne 2  Execution of a RETURN statement terminates the execution of the  enclosing subroutine or function. If the RETURN statement is in a atement as the name of  a common block. A statement function cannot be of type character.   ^ne 6  @RETURN STATEMENT ^zz  A RETURN statement causes return of control to the calling program  unit. It may only appear in a function or subroutine. ment function can only be referenced in the program unit in  which it is defined. The name of a statement function cannot appear in  any specification statement, except in a type statement which may not  define that name as an array, and in a COMMON st function references, however, must refer to statement functions that  have been defined prior to the statement function in which they  appear. Statement functions cannot be recursively called, either  directly or indirectly.    ^ne 2  A state defining it always refers to the formal argument, never to the other  usage.   ^ne 2  Within the expression expr, references to variables, formal arguments,  other functions, array elements, and constants are allowed. Statement lock, or as the name of a formal argument to  another statement function. The type of all such uses, however, must  be the same. If a formal argument name is the same as another local  name, then a reference to that name within the statement function d as other user defined  names in the rest of the program unit containing the statement  function definition. The name of the statement function, however, is  local to its program unit, and must not be used otherwise, except as  the name of a common b the statement function name. The list of formal argument names serves  to define the number and type of arguments to the statement function.  The scope of formal argument names is the statement function.  Therefore, formal argument names may be usee  fname is the name of the statement function.  arg is a formal argument name. ' 'expr is an expression.   ^ne 2  The type of the expr must be assignment compatible with the type of of the subroutine or  function is terminated. Thus, assigning a value to a formal argument  during execution of a subroutine or function may alter the value of  the corresponding actual argument. If an actual argument is a  constant, function reference, or an expression other than a simple  variable, assigning a value to the corresponding formal argument is  not allowed, and may have some strange side effects.   ^ne 2  If an actual argument is an expression, it is evaluated immediately  priord the various backspace  and line delete keys familiar to the system user serve their normal  functions. Note that reading from any other unit will not have these  properties, even though that unit is bound to the console by an  explicit OPEN statemen An asterisk (*) which specifies the Apple console: This is a  sequential, formatted file, also known as unit 0. This particular unit  has the special property that an entire line terminated by the return  key, must be entered when reading from it, an   ^ne 6  @@CHOOSING A FILE STRUCTURE  FORTRAN provides a multitude of possible file structures. Choosing  from among these may at first seem somewhat confusing. However, two  kinds of files will suffice for most applications.   ^ne 2  *G^۞;ictable.  ^bp ent, but any reference to the formal array  must be within the limits of the storage sequence in the actual array.  While a reference to an element outside these bounds is not detected  as an error in a running FORTRAN program, the results are  unpred an expression. A  formal argument that is expressed as an array may be associated with  an actual argument that is an array or an array element. The number  and size of dimensions in a formal argument may be different than  those of the actual argum execution of the procedure, even if it contains variables that are  redefined during the execution of the procedure.   ^ne 2  A formal argument that is a variable may be associated with an actual  argument that is a variable, an array element, or to the association of formal and actual arguments. If an actual  argument is an array element, its subscript expression is evaluated  just prior to the association, and remains constant throughout the t. )  ^ne 3  * Explicitly opened external, sequential, formatted files: These files  are bound to a system file by name in an OPEN statement. They can be  read and written in the system text editor format. % ^ne 3  Here is an example program which uses the kinds of files discussed in  this chapter for reading and for writing. The various I/O statements  are explained in detail later in this chapter.   ^ne 22 %C Copy a file with three columns of integers, eaference whether the file is opened as old or new. With  disk files, opening a file with STATUS='NEW' creates a new  temporary file. If that file is closed using the keep option, or if  the program is terminated without doing a CLOSE on that file, a  read unwritten records in a  direct file. A write to a sequential file effectively deletes any  records which had existed beyond the freshly written record. Normally,  when a device is opened as a file, such as .CONSOLE or .PRINTER, it  makes no dif opened for writing. Therefore, you may open old files and write to  them, with the effect of modifying existing files. Similarly, you may  alternately write and read to the same file, providing that you avoid  reading beyond end of file or trying too obey FORTRAN I/O rules.   ^ne 2  A file opened in FORTRAN is either old or new. An old file just means  one that already exists, while a new one is being used for the first  time. There is no concept of opened for reading as distinguished from ential files but it cannot always enforce them for direct access  files. Direct access files are not necessarily legal .TEXT files since  any unwritten record "holes" contain undefined values which do not  follow .TEXT file conventions. Direct files d and conversions.   ^ne 2  Use of formatted direct access files requires special caution. FORTRAN  formatted files attempt to comply with the operating system rules for  .TEXT files. The FORTRAN I/O system is able to enforce these rules for  sequ interpret certain characters, such as the ASCII representation for  carriage return, and fail to pass them through to the program  unaltered. Internal files are not I/O in the conventional sense but  rather provide certain character string operations may  contain only the printable character set as data.   ^ne 2  A good example of unformatted I/O would be the control of a device  which has a single byte, binary interface. Formatted I/O would or a database created, maintained, and accessed exclusively  by FORTRAN. If the data must be transferred without any system  interpretation, especially if all 256 possible bytes will be  transferred, unformatted I/O will be necessary, since .TEXT fileses are probably necessary. If  the data is to be written by FORTRAN and reread by FORTRAN on the same  type of system, unformatted files are more efficient both in file  space and in I/O overhead. The combination of direct and unformatted  is ideal f The less commonly used file structures are appropriate for certain  classes of applications. A very general indication of the intended  usages for them follows: If the I/O is to be random access, such as in  maintaining a database, direct access filxcept 0 and 3 will do +OPEN(4,FILE='OUT.TEXT',STATUS='NEW') %C Read and write until end of file %100 READ(3,920,END=200)I,J,K +WRITE(4,920)J,I,K %920 FORMAT(3I7) +GOTO 100 %200 WRITE(*,910)'Done' +END &  ^ne 2 00 FORMAT('Input file name - '$) %C Read the file name from the .CONSOLE by reading from * +READ(*,910) FNAME %910 FORMAT(A) %C Use unit 3 for input, any unit number except 0 will do +OPEN(3,FILE=FNAME) %C Use unit 4 for output, any unit number ech 7 columns wide %C from a file whose name is input by the user to another file named %C OUT.TEXT reversing the positions of the first and second column. +PROGRAM COLSWP +CHARACTER*23 FNAME %C Prompt to the .CONSOLE by writing to * +WRITE(*,900) %9permanent file is created with the name given when the file was  opened. If a previous file existed with the same name, it is deleted.  If closed using the delete option, the newly created temporary file is  deleted, and any previous file of the same name is left intact.  Opening a disk file as old that does not exist, will generate a  run-time error. Note that within FORTRAN, it is safer to explicitly  CLOSE a file that was OPENed.     ^ne 6    @@CHAPTER 11    @@@INPUT/OUTPUT OPERATIONS   !74 I/O Overview !74 Records !75 Files !75 Formatted vs. Unformatted Files !75 Sequential vs. Direct Acccess !76 Internal Files !76 Units !77 Choosing a File StructureG^۞#a function to be called. That  function call must not cause any I/O statement to be executed.   stem disallows  backspacing a file on a sequential device.   ^ne 2  There is also a limitation on calling functions within an individual  I/O statement. During the course of executing any I/O statement, the  evaluation of an expression may cause  position on a file which is not blocked, the FORTRAN I/O system does  not allow direct file access to sequential devices.   ^ne 3  Sequential devices cannot be backspaced meaningfully under the Apple  Pascal operating system, so the FORTRAN I/O syvices, such  as disk files, have the additional operation of seeking a specific  location. They can be accessed either sequentially or randomly and  thus can support direct files. Since there is no notion of seeking a s two kinds of devices, blocked and sequential.  A sequential file may be thought of as a stream of characters, with no  explicit motion allowed except reading and/or writing. The .CONSOLE  and .PRINTER are examples of sequential devices. Blocked de@@I/O LIMITATIONS  Within the FORTRAN I/O system, there are limitations pertaining to  direct access files, backspacing, and function calls within I/O  statements. These limitations are discussed in this section.   ^ne 2  The operating system ha !79 I/O Limitations !79 I/O Statements !81 OPEN !83 CLOSE !84 READ !85 WRITE !85 BACKSPACE !86 ENDFILE !86 REWIND !86 Notes on I/O Operations %  ^bp     @@I/O OVERVIEW  Input/output (I/O) statements are all statements that transfer data  between the program and any devices attached to your Apple, such as  disk drives, the Apple's keyboard and screen, a printer, and the  like. Each device to be used as the source or target of I/O is  assigned a unit * A file has a position property which is usually set by the previous  I/O operation. There is a notion of the initial point in the file, the  terminal point in the file, the current record, the preceding record,  and the next record of the file. Ita name is a character string  identical to the pathname by which it is known to SOS (the UCSD file name convention is supported).  There may be more than one name for the same file, such as SYS/A.TEXT  and .d2/A.TEXT.   ^ne 2 mbiguity disappears since after opening a file, the two  notions are one and the same.  ^ne 2  A file which is being acted upon by a FORTRAN program has a variety of  properties as described below:   ^ne 2  * A file may have a name. If present, le (as known to the operating  system and to the editor) will be referred to simply as files, with  the context determining which meaning is intended. The OPEN statement  provides the linkage between the two notions of files and, in most  cases, the a ^ne 2  An external FORTRAN file is a file on a device or a device itself. An  internal FORTRAN file is a character variable that serves as the  source or destination of some I/O action. From this point on, both  FORTRAN files and the notion of a fiord is there.   ^ne 2  It should be noted that FORTRAN numbers records starting from 1, but  Pascal numbers records from 0.   ^ne 5  @FILES ^zz  FORTRAN files are sequences of records. FORTRAN files may be either  internal or external. % tial, unformatted files on block devices do have a structure. The first word (two bytes) is the record length. On unblocked devices there is no structure.   ^ne 2  The system makes it appear as though an endfile record exists, but no  actual recORTRAN is identical to other  system programs and other languages on the system.  ^ne 5  An unformatted record is a sequence of values, with no system  alteration or interpretation. No physical representation for the end  of record exists. Sequen character value 13 which corresponds to the RETURN key on the Apple.  Formatted records are interpreted on input in the same way that the  operating system and text editor interpret characters. Thus, reading  characters from formatted records from F file system is the Record. A Record  is a sequence of characters or a sequence of values. There are three  kinds of records: %  * Formatted  * Unformatted  * Endfile   ^ne 2  A formatted record is a sequence of characters terminated by the cture  of the FORTRAN I/O system. Most I/O tasks can be accomplished without  a complete understanding of this material and the reader is encouraged  to use this chapter primarily for reference.  %  @RECORDS ^zz  The building block of the FORTRAN the system. The I/O system provided by Apple FORTRAN is a superset of  the ANSI Standard subset FORTRAN 77.   In order to fully understand the I/O statements, it is necessary to be  familiar with a variety of terms and concepts related to the stru the direction of data transfer. FORMAT statements are used to edit the  form of the data to be transferred.   This chapter discusses the FORTRAN I/O system and statements, and  gives some general considerations that apply to handling files under  number. The transfer of data takes place between the  variables in your program and the appropriate device number, both of  which must be properly specified in the I/O statements that indicate is reasonable to be between  records in a file, in which case the next record is the successor to  the previous record and there is no current record. The file position  after sequential writes is at the end of file, but not beyond the  endfile record. Execution of the ENDFILE statement positions the file  beyond the endfile record, as does a read statement executed at the  end of file (but not beyond the endfile record). Reading an endfile  record may be trapped by the user using the END= option entire record be written by a WRITE statement, the remaining portion  of the record is filled with blanks. The file position is always at  the beginning of the file prior to I/O statement execution. Only  formatted, sequential I/O is permitted to intion.   ^ne 2  An internal file is a character variable or character array element.  The file has exactly one record, which has the same length as the  character variable or character array element. Should less than the al character representations. That is, reading a character  variable converts the character values into numeric, logical, or  character values and writing into a character variable allows values  to be converted into their external character representat the success of this  depends on the existence of room on the physical device.   ^ne 5  @INTERNAL FILES ^zz  Internal files provide a mechanism for using the formatting  capabilities of the I/O system to convert values to and from their  extern such as disks, so that it is meaningful to specify a position in  the file and reference it. The system will attempt to extend direct  access files if an attempt is made to write to a position beyond the  previous terminating boundary of the file, buess file which has  not been written, but the system will not detect this error unless the  record which is being read is beyond the last record written in the  file. Direct access files must reside on blocked peripheral devices writing record 9, 5, and 11 in that  order without the records in between. It is not possible to delete a  record once written, but it is possible to overwrite a record with a  new value.   ^ne 2  It is an error to read a record from a direct acc is specified at the  time the file is opened. Each record in the file is uniquely  identified by its record number, which was specified when the record  was written. It is entirely possible to write the records out of  order, including, for example, Direct access files may be read or written in any order (they are  random access files). Records in a direct access file are numbered  sequentially, with the first record numbered one. All records in a  direct access file have the same length, whichial access files  if a record is written beyond the old terminating boundary of the  file, but the success of this depends on the existence of room on the  physical device at the end of the file.   ^ne 2 tain records with an order property determined by the order  in which the records were written. These files must not be read or  written using the REC= option which specifies a position for direct  access I/O. The system will attempt to extend sequent are formatted obey all  the structural rules of .TEXT files, so that they are fully compatible  with the system editor.   ^ne 5  @SEQUENTIAL VS. DIRECT ACCESS ^zz  An external file is opened as either sequential or direct. Sequential  files con An external file is opened as either formatted or unformatted. All  internal files are formatted. Files which are formatted consist  entirely of formatted records and files which are unformatted consist  entirely of unformatted records. Files which in a READ  statement. Should the end of file record be detected in this manner,  the program can then be directed to branch, or other appropriate  action may be taken.  ^ne 5  @FORMATTED VS. UNFORMATTED FILES ^zz ternal files and only the  I/O statements READ and WRITE may specify an internal file.   ^ne 6  @UNITS ^zz  A unit is a means of referring to a file. A unit specified in an I/O  statement may be either an external unit specifier or an internal unit  specifier. %  ^ne 2  External unit specifiers are either integer expressions which evaluate  to positive values or the character * which stands for the .CONSOLE  device. In most cases, external unit specifier values represent  physical deviceiting  96 A Character Editing   ^bp     @@INTRODUCTION   This chapter describes formatted I/O and the FORMAT statement. Some  familiarity with the FORTRAN file system, units, records, access  methods, a / Slash Editing  93 $ Dollar Sign Editing  94 P Scale Factor Editing  94 BN/BZ Blank Interpretation  94 Repeatable Edit Descriptors  95 I Integer Editing  95 F Real Editing  95 E Real Editing  96 L Logical Ed   @@CHAPTER 12    @@@FORMATTED I/O   !90 Introduction !90 Formatting I/O !91 Formatting and the I/O List !92 Nonrepeatable Edit Descriptors !92 Apostrophe Editing !93 H Hollerith Editing !93 X Positional Editing !93 G^{@ continues until an explicit CLOSE occurs or until the program  terminates. The only exception to the above is that the unit value 0  is initially associated with the .CONSOLE device for reading and  writing and no explicit OPEN is necessary. s or files resident on those devices by name using the  OPEN statement. After the OPEN statement, FORTRAN I/O statements refer  to the unit number instead of the name of the external entity. This nd I/O statements as described in the previous chapter is  assumed.     @@FORMATTING I/O  If a READ or WRITE statement specifies a format, in parentheses  immediately following the READ or WRITE statement, it is considered a  formatted, rather than an unformatted I/O statement. Such a format may  be specified in one of three ways, as explained in the previous  chapter. Two ways refer to FORMAT statemele edit descriptors act as if they were present r  times; omitted r is treated as a repeat factor of 1. Similarly, a  nested format specification is treated as if its items appeared r  times.   ^ne 2  The formatted I/O process proceeds as follows:ement execution. In  contrast, the remaining format control items interact directly with  the record and do not become associated with items in the iolist.   ^ne 2  The items in a format specification are interpreted from left to  right. Repeatab specified in the iolist, in which case the only action caused by the  I/O statement is the implicit record skipping action associated with  formats. Each item in the iolist will become associated with a  repeatable edit descriptor during the I/O statntains one or more items, at least one repeatable edit  descriptor is required in the format specification. In particular, the  empty edit specification, (), may be used only if no items are greater detail the manner of editing specified by  each of the above edit descriptors, it should be understood how the  format specification interacts with the input/output list (iolist) in  a given READ or WRITE statement.   ^ne 2  If an iolist coign, P, BN, and BZ indicate the  manner of editing and, % %x is any ASCII character, %n is a nonzero, unsigned, integer constant, and %k is an optionally signed integer constant.    ^ne 5  @@FORMATTING AND THE I/O LIST  Before describing in  The nonrepeatable edit descriptors, also explained in detail  below, are:  %'xxxx' - character constants of any length %nHxxxx - another means of specifying character constants %nX %/ %$ %kP %BN %BZ %  where apostrophe, H, X, slash, dollar s below, are: % %Iw %Fw.d %Ew.d %Ew.dEe %Lw %A %Aw   where I, F, E, L, and A indicate the manner of editing and,  %w and e are nonzero, unsigned, integer constants, and %d is an unsigned integer constant. % on. The comma separating two list items may be  omitted if the resulting format specification is still unambiguous,  such as after a P edit descriptor or before or after the / edit  descriptor.   The repeatable edit descriptors, explained in detailedit descripors %  ^ne 2 %[r] fs - a nested format specification. At most 3 levels of %nested parentheses are permitted within the outermost level. %  ^ne 2  where r is an optional, nonzero, unsigned, integer constant called a  repeat specificati statements, may not be the target of a branching operation.   Between the initial and terminating parentheses is a list of items,  separated by commas, each of which is one of these: % %[r] ed - repeatable edit descriptors % %ned - nonrepeatable ial blank characters. It must end  with a matching closing or right parenthesis. Characters beyond the  closing parenthesis are ignored.   FORMAT statements must be labeled, and like all nonexecutable O IFMT %990 FORMAT(2I5,I3) +WRITE(*,IFMT)I,J,K % +WRITE(*,'(2I5,I3)')I,J,K + +CHARACTER*8 FMTCH +FMTCH = '(2I5,I3)' +WRITE(*,FMTCH)I,J,K %  The format specification itself must begin with a left or opening  parenthesis, possibly following initnts and one is an immediate  format in the form of a character expression containing the format  itself. The following are all valid and equivalent means of specifying  a format:   ^ne 12 +WRITE(*,990)I,J,K %990 FORMAT(2I5,I3) % +ASSIGN 990 T The format controller  scans the format items in the order indicated above. When a  repeatable edit descriptor is encountered, either: %  ^ne 3  * A corresponding item appears in the iolist in which case the item  and the edit descriptor become associated and I/O of that item  proceeds under format control of the edit descriptor, or %  * The format controller terminates I/O. %  ^ne 2  If the format controller encounters the matching right parentheses of  thescriptor  encountered by the format controller is the dollar sign, this  automatic end of record is inhibited. This allows subsequent I/O  statements to continue reading or writing out of or into the same  record. The most common use for this mechanitten and the file is positioned to  write on the beginning of the next record.    ^ne 5  @$ DOLLAR SIGN EDITING ^zz  Normally when the format controller terminates, the end of data  transmission on the current record occurs. If the last edit d descriptor results in no operation.    ^ne 5  @/ SLASH EDITING ^zz  The slash indicates the end of data transfer on the current record. On  input, the file is positioned to the beginning of the next record. On  output, an end of record is wror causes the file position to  advance over n characters, thus the next n characters are skipped. On  output (WRITE), the nX edit descriptor causes n blanks to be written,  providing that further writing to the record occurs, otherwise, the nX the blanks in the following format are actually spaces +WRITE(*,950) %950 FORMAT(80H12345 012345 012345 012345 01234567890 ( C12345 012345 01234567890) +  ^ne 5  @X POSITIONAL EDITING ^zz  On input (READ), the nX edit descriptAT('ABC''DEF') +WRITE(*,'(''ABC''''DEF'')') +WRITE(*,'(7HABC''DEF)') +WRITE(*,960) %960 FORMAT(7HABC'DEF) If a Hollerith field spans more than one line, spaces must actually be in the text and not assumed as shown in the following example. %C All  blanks, to be transmitted to the output. Hollerith editing may not to  be used for input (READ).   ^ne 9  Examples of Apostrophe and Hollerith editing:  %C Each write outputs characters between the slashes: /ABC'DEF/ +WRITE(*,970) %970 FORMbe used for input (READ). It  causes the character constant to be transmitted to the output unit.    ^ne 6  @H HOLLERITH EDITING ^zz  The nH edit descriptor causes the following n characters, including the nonrepeatable edit descriptors.   ^ne 5  @APOSTROPHE EDITING ^zz  The apostrophe edit descriptor has the form of a character constant.  Embedded blanks are significant and double '' are interpreted as a  single '. Apostrophe editing may not pped or an end of  record is written on output, except as noted under the $ edit  descriptor.    ^ne 5  @@NONREPEATABLE EDIT DESCRIPTORS  Here are the detailed explanations of the various format specification  descriptors, beginning with  number of times to repeat that nested format specification. The rescan  does not change the previously set scale factor or BN or BZ blank  control in effect. When the format controller terminates, the  remaining characters of an input record are skig. Within the portion of the format  rescanned, there must be at least one repeatable edit descriptor.  Should the rescan of the format specification begin with a repeated  nested format specification, the repeat factor is used to indicate the nues by rescanning the  format starting at the beginning of the format specification  terminated by the last preceding right parenthesis. If there is no  such preceding right parenthesis, the format controller will rescan  the format from the beginnine format specification and there are no further items in the iolist,  the format controller terminates I/O. If, however, there are further  items in the iolist, the file is positioned at the beginning of the  next record and the format controller contiism is to prompt the user  to respond on the keyboard, and to READ a response off the same line  as in:   ^ne 2 *WRITE(*,'(A$)') 'Input an integer -> ' *READ(*,'(BN,I6)') I   ^ne 2  The dollar sign edit descriptor does not inhibit the automatic end of  record generated when reading from the * unit. Input from the .CONSOLE  must always be terminated by the return key. This permits the  backspace character and the line delete keit descriptor.   ^ne 5  @F REAL EDITING ^zz  The edit descriptor Fw.d must be associated with an iolist item which  is of type real. The width of the field is w positions, the fractional  part of which consists of d digits. The input field beG ^zz  The edit descriptor Iw must be associated with an iolist item which is  of type integer. The field width is w characters in length. On input,  an optional sign may appear in the field. The general rules of numeric  editing apply to the I ed with padding leading blanks if necessary. '  ^ne 3  * On output, if the number of characters produced exceeds the field  width or the exponent exceeds its specified width, the entire field is  filled with asterisks.   ^ne 5  @I INTEGER EDITINOn input, with F and E editing, an explicit decimal point appearing  in the input field overrides the edit descriptor specification of the  decimal point position. '  ^ne 2  * On output, the characters generated are right justified in the field ee of them:   ^ne 3  * On input, leading blanks are not significant. Other blanks are  interpreted differently depending on the BN or BZ flag in effect, but  all blank fields always become the value 0. Plus signs are optional.   ^ne 3  * adding at  the end of formatted records, makes interactive input very convenient.    ^ne 5  @@REPEATABLE EDIT DESCRIPTORS  The I, F, and E edit descriptors are used for I/O of integer and real  data. The following general rules apply to all thr value 123 where indicates hitting the return key:   ^ne 7 &READ(*,100) I  100 FORMAT(BN,I6) % %/123 /, %/123 456/, %/123/, or  / 123/.  ^ne 3  The BN edit descriptor, in conjunction with infinite blank p were right-justified in the field with the number of leading blanks  equal to the number of ignored blanks. For instance, the following  READ statement accepts the characters shown between the slashes as the or is processed by the format controller,  blanks in subsequent input fields will be ignored until a BZ edit  descriptor is processed. The effect of ignoring blanks is to take all  the non-blank characters in the input field, and treat them as if they TATION ^zz  These edit descriptors specify the interpretation of blanks in numeric  input fields. The default, BZ, is set at the start of each I/O  statement. This makes blanks, other than leading blanks, identical to  zeros. If a BN edit descript * On output, with E editing, the real part of the quantity is output  multiplied by 10**k and the exponent is reduced by k, effectively  altering the column position of the decimal point but not the value  output. '  ^ne 5  @BN/BZ BLANK INTERPREented number equals the internally represented number multiplied  by 10**k. '  ^ne 2  * On input, with F and E editing, the scale factor has no effect if  there is an explicit exponent in the input field. '  ^ne 2 the scale factor  begins at 0. The scale factor effects format editing in the following  ways:   ^ne 3  * On input, with F and E editing, providing that no explicit exponent  exists in the field, and F with output editing, the externally  represy to function properly.   ^ne 5  @P SCALE FACTOR EDITING ^zz  The kP edit descriptor is used to set the scale factor for subsequent  F and E edit descriptors until another kP edit descriptor is  encountered. At the start of each I/O statement,gins with an  optional sign followed by a string of digits optionally containing a  decimal point. If the decimal point is present, it overrides the d  specified in the edit descriptor, otherwise the rightmost d digits of  the string are interpreted as following the decimal point. Leading  blanks are converted to zeros if necessary. Following this is an  optional exponent which is one of these:   ^ne 4  * Plus or minus followed by an integer.  * E or D followed n output, if w should exceed the characters  produced by the iolist item, leading blanks are provided, otherwise,  the leftmost w characters of the iolist item are output.  ^bp or equals the number of  characters in the iolist element, the rightmost characters of the  input field are used as the input characters, otherwise the input  characters are left justified in the input iolist item and trailing  blanks are provided. O acquires an implied field width, w, from the number of characters in  the iolist item with which it becomes associated. The iolist item must  be of the character type if it is to be associated with an A or Aw  edit descriptor. On input, if w exceeds.FALSE. are  valid inputs. On output, w - 1 blanks are followed by either T or F as  appropriate.   ^ne 5  @A CHARACTER EDITING ^zz  The forms of the edit descriptor are A or Aw, in which the former be of type logical. On input, the field consists of  optional blanks, followed by an optional decimal point, followed by T  (for .TRUE.) or F (for .FALSE.). Any further characters in the field  are ignored, but accepted on input, so that .TRUE. and es of numeric editing apply to the E edit descriptor.    ^ne 5  @L LOGICAL EDITING  ^zz  The edit descriptor is Lw, indicating that the field width is w  characters. The iolist element which becomes associated with an L edit  descriptor must  and d + k significant digits after this. If 0 < k < d+2 then the  output field contains exactly k significant digits to the left of the  decimal point and d - k - 1 places after the decimal point. Other  values of k are errors.   The general rul.   ^ne 2  The scale factor controls the decimal normalization of the printed E  field. If the scale factor, k, is in the range -d < k <= 0 then the  output field contains exactly -k leading zeros after the decimal point by plus or minus followed %Ew.dEe exp by e digits which are the exponent -<= (10**e) -1 with possible leading zeros.   ^ne 2  The form Ew.d must not be used if the absolute value of the exponent  to be printed exceeds 999nt field for  exponent, exp, of one of the following forms:  ^ne 2 %Ew.d -99 <= exp <= 99 E followed by plus or minus followed % by the two digit exponent.   ^ne 3  -((10**e) - 1) <= E followed  the output field depends on the scale factor set by the P edit  descriptor that is in effect. For a scale factor of 0, the output  field is a minus sign if necessary, followed by a decimal point,  followed by a string of digits, followed by an exponew.dEe. In either  case the field width is w characters. The e has no effect on input.  The input field for an E edit descriptor is identical to that  described by an F edit descriptor with the same w and d. The form of item and  the current scale factor. The output value is rounded rather than  truncated.   The general rules of numeric editing apply to the F edit descriptor.   ^ne 2  @E REAL EDITING ^zz  An E edit descriptor either takes the form Ew.d or Eby zero or more blanks followed by an optional sign  followed by an integer. E and D are treated identically.  ^ne 2  The output field occupies w digits, d of which fall beyond the decimal  point and the value output is controlled both by the iolist O^SO^Sh are Pascal Text Files). Use Pascal Menu.Maker, disk 3PCL-10 to read or System Utilities to print (disk 3SYS-02 - use "Copy Files" and copy to .Printer). copy to -: .Printer). -: - WAP /// SIG PUBLIC DOMAIN LIBRARY PDS NAME: FORTRAN Manual: Disk 2 DISK ID#: 3PCL-18 BOOTABLE?: Nonbootable DESCRIPTION: Disk Two of Two disks containing the manual for the Fortran Language. Pascal required to read/print these files (whic3b  ^so jback4:new13c  ^zs  ^fo ''%  ^he '''Control Statements  ^so jback4:new10  ^he '''Input/Output Operations  ^so jback4:new11a  ^so jback4:new11b  ^so jback4:new11c  ^he '''Formatted I/O  ^so jback4:new12  ^he '''Program Units  ^so jback4:new13a  ^so jback4:new1$ compiler directive  9 Input source file not valid textfile format  10 Maximum depth of include file nesting exceeded  11 Integer constant overflow  12 Error in real constant  13 Too many digits in constant  14 Identifier too long  15 3 Too many continuation lines  4 Fatal end of file encountered  5 Labeled continuation line 6 Missing field on $ compiler directive line  7 Unable to open listing file specified on $ compiler directive  line  8 Unrecognizable     @@APPENDIX B   @@@FORTRAN ERROR MESSAGES    172 Compile-time Error Messages  176 Run-time Error Messages  ^bp   @@COMPILE-TIME ERROR MESSAGES   1 Fatal error reading source block  2 Nonnumeric characters in label field  1 2 G^ʦS: ^zs  ^fo ''%  ^he '''File Name Selection  ^so jback6:newapa  ^he '''FORTRAN Error Messages  ^so jback6:apb  ^he '''Tables  ^so jback6:apc  Character constant extends to end of line  16 Character constant zero length  17 Illegal character in input  18 Integer constant expected  19 Label expected  20 Error in label 21 Type name expected (INTEGER, REAL, LOGICAL, or CHARACTER[*n])  22 Integer constant expected  23 Extra characters at end of statement  24 '(' expected  25 Letter IMPLICIT'ed more than once  26 ')' expected  27 Letter expected  28 Ier unit %via a $USES command  87 Error in type of argument to an INTRINSIC FUNCTION  88 SUBROUTINE/FUNCTION was previously used as a FUNCTION/SUBROUTINE  89 Unrecognizable statement  90 Functions cannot be of type CHARACTER  91 Missing END tch actual  type of INTRINSIC function  83 Letter expected  84 Type of FUNCTION does not agree with a previous call  85 This procedure has already appeared in this compilation  86 This procedure has already been defined to exist in anoth 78 Type conflict in DATA statement  79 Number of variables does not match number of values in DATA  statement list  80 Statement cannot have label  81 No such INTRINSIC function  82 Type declaration for INTRINSIC function does not mariables cannot appear in DATA statements  74 SUBROUTINE names, FUNCTION names, INTRINSIC names, etc. cannot  appear in DATA statements  75 Subscript out of range in DATA statement  76 Repeat count must be >= 1  77 Constant expected appearance  69 Adjustable bound must be simple integer variable  70 Cannot have more than 1 main program  71 The size of a named COMMON must be the same in all procedures  72 Dummy arguments cannot appear in DATA statements  73 COMMON vaed for dummy  arrays  66 Adjustable-size array declarations can only be used for dummy  arrays  67 Assumed-size array dimension specifier must be last dimension  68 Adjustable bound must be either parameter or in COMMON prior to   61 Illegal assignment - types do not match  62 Can only call SUBROUTINES  63 Dummy parameters cannot appear in COMMON statements  64 Dummy parameters cannot appear in EQUIVALENCE statements  65 Assumed-size array declarations can only be us compatible  55 Type of expression must be LOGICAL  56 Too many subscripts  57 Too few subscripts  58 Variable expected  59 '=' expected  60 Size of EQUIVALENCE'd CHARACTER items must be the same d with non-character items  50 Illegal symbol in expression  51 Can't use SUBROUTINE name in an expression  52 Type of argument must be INTEGER or REAL  53 Type of argument must be INTEGER, REAL, or CHARACTER  54 Types of comparisons must beQUIVALENCE statement forces a variable to two distinct  locations, not in a COMMON block  47 Statement number expected  48 Mixed CHARACTER and numeric items not allowed in same COMMON  block  49 CHARACTER items cannot be EQUIVALENCE' with variable declaration  43 EQUIVALENCE subscript out of range  44 Two distinct cells EQUIVALENCE'd to the same location in a COMMON  block  45 EQUIVALENCE statement extends a COMMON block in the negative  direction  46 E39 Named COMMON block already saved  40 Variable already appears in a COMMON block  41 Variables in two different COMMON blocks cannot be equivalenced  42 Number of subscripts in EQUIVALENCE statement does not agree ation  statement  34 This identifier has already been declared  35 This intrinsic function cannot be passed as an argument  36 Identifier must be a variable  37 Identifier must be a variable or the current FUNCTION  38 '/' expected  dentifier expected  29 Dimension(s) required in DIMENSION statement  30 Array dimensioned more than once  31 Maximum of 3 dimensions in an array  32 Incompatible arguments to EQUIVALENCE  33 Variable appears more than once in a type specificstatement  92 A program unit cannot appear in a separate compilation  93 Fewer actual arguments than formal arguments in  FUNCTION/SUBROUTINE call  94 More actual arguments than formal arguments in  FUNCTION/SUBROUTINE call  95 Type of actual argument does not agree with type of format  argument  96 The following procedures were called but not defined:  97 This procedure was already defined by a $EXT directive  98 Maximum size of type CHARACTER is 255, mini CHARACTER  204 Unable to open $USES file  205 Too many $USES statements  206 No .TEXT info for this unit in $USES file  207 Illegal segment kind in $USES file  208 There is no such unit in this $USES file  209 Missing UNIT name in $USES statemre '( )'  170 Only sequential formatted files can be print files   200 Error in reading $USES file  201 Syntax error in $USES file  202 SUBROUTINE/FUNCTION name in $USES file has already been declared  203 FUNCTIONS cannot return values of type 164 Integer variable used as assigned format but no ASSIGN statements  165 Label of an executable statement used as a format  166 Integer variable expected for assigned format  167 Label defined more than once as format  169 Function calls requiognizable I/O unit  160 Unrecognizable format in I/O statement  161 Options expected after ',' in I/O statement  162 Unrecognizable I/O list element  163 Label used as format but not defined in format statement DO  154 Expressions not allowed as reading I/O list elements  155 REC= option appears twice in statement  156 REC= expects integer expression  157 END= option only allowed in READ statement  158 END= option appears twice in statement  159 Unrec specify RECL= in OPEN statement  151 Adjustable arrays not allowed as I/O list elements  152 End of statement encountered in implied DO, expressions beginning %with '(' not allowed as I/O list elements  153 Variable required as control for implied  146 FILE= option must be present in OPEN statement  147 RECL= option specified twice in OPEN statement  148 Integer expression expected for RECL= option in OPEN statement  149 Unrecognizable option in OPEN statement  150 Direct access files muster constant as option  142 Character constant expected as option  143 Integer expression expected for unit designation  144 STATUS option expected after ',' in CLOSE statement  145 Character expression as filename in OPEN 4 FORMAT label already referenced  135 FORMAT must be labeled  136 Identifier expected  137 Integer variable expected  138 'TO' expected  139 Integer expression expected  140 Assigned GOTO but no ASSIGN statements  141 Unrecognizable charact type  127 RETURN forbidden in this context  128 STOP forbidden in this context  129 END forbidden in this context  131 Label referenced but not defined  132 DO or IF block not terminated  133 FORMAT statement not permitted in this context  13 121 Assigned GOTO forbidden in this context  122 Block IF statement forbidden in this context  123 Logical IF statement forbidden in this context  124 Arithmetic IF statement forbidden in this context  125 ',' expected  126 Expression of wrongELSE block  114 '(' expected  115 ')' expected  116 THEN expected  117 Logical expression expected  118 ELSE statement forbidden in this context  119 No matching IF for ELSE  120 Unconditional GOTO forbidden in this context abel must follow DO statement  108 ENDIF forbidden in this context  109 No matching IF for this ENDIF  110 Improperly nested DO block in IF block  111 ELSEIF forbidden in this context  112 No matching IF for ELSEIF  113 Improperly nested DO or mum is 1   100 Statement out of order  101 Unrecognizable statement  102 Illegal jump into block  103 Label already used for FORMAT  104 Label already defined  105 Jump to format label  106 DO statement forbidden in this context  107 DO lent  210 Extra characters at end of $USES directive  211 Intrinsic units cannot be overlayed  212 Syntax error in $EXT directive  213 A SUBROUTINE cannot have a type  214 SUBROUTINE/FUNCTION name in #EXT directive has already been  define   400 Code file write error  401 Routine too complex  402 Too many SUBROUTINES/FUNCTIONS in segment  403 Procedure too large (code buffer too small)  404 Insufficient room for scratch file in system directory  405 Read erroo do unformatted I/O to internal unit  665 Attempt to put more than one record into internal unit  666 Attempt to write more characters to internal unit than its length  667 EOF called on unknown unit  697 Integer variable not currently assigned a access unit beyond end of file for  reading  660 Attempt to backspace unit connected to unblocked device   662 Argument to ASIN or ACOS out of bounds (ABS(X) .GT. 1.0)  663 Argument to SIN or COS too large (ABS(X) .GT. 10E6)  664 Attempt t 656 Attempt to position a unit for direct access on a nonpositive  record number  657 Attempt to do direct access to a unit opened as sequential  658 Attempt to position direct access unit on unblocked device  659 Attempt to position direct t of or into a direct access unit record  653 Incorrect number of bytes read from a direct access unit record  654 Attempt to open direct access unit on unblocked device  655 Attempt to do external I/O on a unit beyond end of file record as formatted  648 Unable to write blocked output, possibly no room on device  for file  649 Unable to read blocked input  650 Error in formatted textfile, no in last 512 bytes  651 Integer overflow on input  652 Too many bytes read ou d field + 1  643 Scale factor out of range of d field in E format  644 E or F format expected for real write  645 L format expected for logical write  646 A format expected for character write  647 Attempt to do unformatted I/O to a unit opened  636 Digit expected in formatted real read  637 L format expected for logical read  639 T or F expected in logical read  640 A format expected for character read  641 I format expected for integer write  642 w field in F format not greater thaner  631 Formatted I/O attempted on file opened as unformatted  632 Format fails to begin with '('  633 I format expected for integer read  634 F or E format expected for real read  635 Two '.' characters in formatted real read for reading  626 Character constant in format must not be repeated  627 '/' in format must not be repeated  628 '$' in format must not be repeated  629 BN or BZ format control must not be repeated  630 Attempt to perform I/O on unknown unit numbactor in format  621 Maximum nesting level for formats exceeded  622 ')' has repetition factor in format  623 Integer followed by ',' illegal in format  624 '.' is illegal format control character  625 Character constant must not appear in format 616 X field in format requires repetition factor  617 P field in format requires repetition factor  618 Integer appears before '+' or '-' in format  619 Integer expected after '+' or '-' in format  620 P format expected after signed repetition fitive integer required for e field in format  613 Positive integer required for w field in A format  614 Hollerith field in format must not appear for reading  615 Hollerith field in format requires repetition factor character in format   607 Integer expected for w field in format  608 Positive integer required for w field in format  609 '.' expected in format  610 Integer expected for d field in format  611 Integer expected for e field in format  612 Posr on scratch file  ^bp   @@RUN-TIME ERROR MESSAGES   600 Format missing final ')'  601 Sign not expected in input  602 Sign not followed by digit in input  603 Digit expected in input  604 Missing N or Z after B in format  605 Unexpected format label  698 End of file encountered on read with no END= option  699 Integer variable not ASSIGNed a label used in assigned goto  700 Attempt to backspace UCSD file - Restriction 701 Underflow in TAN 702 Argument to LN negative or zero 703 Argument to SQRT negative 704 Too many bytes read out of unformatted sequential unit record 902 Bad unit number 903 Illegal operation (e.g., read from .PRINTER)  905 Lost unit -- no longer on line 906 Lost file -- file is no longer in director    @@APPENDIX A   @@@FILE NAME SELECTION   136 Introduction 136 Pathname Selection 137 File Selection  138 Editing Input Fields  139 SOS Error Messages  ^bp   @@INTRODUCTION ^ne 4  Chapter 4 discusses the res O^ʦۦE+Invalid bitmap address has been found on volume   1000+ Compiler debug error messages - should never appear in  correct programs  ^bp   ror 982 Directory is not in SOS format 983 Invalid value in list parameter 984 Out of free memory for system buffer 985 Buffer table is full 986 Invalid system buffer parameter 987 Duplicate volume error 988 Not a block device 989 Level error 990 filename 972 Overrun error 973 Directory is full 974 Incompatible file format 975 Unsupported storage type 976 End of file error 977 Position is out of range 978 Access error 979 User-supplied buffer is too small 980 File is busy 981 Directory er946 Diskette has been switched  964 Invalid pathname syntax 965 Character file control block is full 966 Block file control block is full 967 Invalid file reference number 968 Path not found 969 Volume not found 970 File not found 971 Duplicate 934 Invalid control/status parameter 935 Device is not open  937 Resource is not available 938 Invalid operation 939 I/O error  943 Device is write-protected 944 Byte count is not a multiple of 512 945 Block number is too large Bad input format -- error in reading number 915 Ring buffer overflow -- input arriving too fast 916 Write-protect error -- disk is protected  919 Too many files open for system to handle   932 Invalid request code 933 Invalid control/status codey 907 Illegal pathname 908 No room -- insufficient space in directory 909 No unit -- unit is not on line 910 No such file in specified directory 911 Duplicate pathname 912 Attempt to open an already open file 913 Attempt to access a closed file 914 ponses to the codefile prompt (during compilation) and it was noted that you could enter a "$" as an abbreviation to indicate that the previous name (the input pathname) was to be used. This is only one special case of a more general abbreviation facility allowed in response to all pathname prompts. Additionally, there is a menu facility that allows you to examine all the files that share a common prefix. From this menu, you can then select the file you wish to enter. If you make a mistake or wish tcannot be used (except, of course, for the abbreviation "*"). Once the input file is specified, a prefix and a suffix is determined, so the codefile specification can refer to the input file's prefix and suffix. The codefile specification, in turn, ds are based on a previous pathname. Initially, when you are prompted for the input field, there is no previous pathname. Thus the initial prefix and suffix are both null so that these abbreviations ---> ~/P/Q/R/S ($XYZ or $/XYZ --->~ /P/Q/R/XYZ (^XYZ or ^/XYZ ---> /P/Q/XYZ (^^XYZ or ^^/XYZ ---> /P/XYZ (^^^XYZ or ^^^/XYZ ---> XYZ (.D1$ or .D1/$ ---> .D1/S ( ^ne 4 Note that these abbreviationrefix in the first place. Thus ^^^XYZ or ^^^/XYZ is the same as just XYZ>  ^ne 5 ^tr ~  The following table summarizes these abbreviation rules using the examples we have been using (previous pathname /P/Q/R/S, current file - XYZ): ($ prefix /P/Q is to be used (as in ^XYZ or ^/XYZ to mean /P/Q/XYZ). Two "^"s, i.e., "^^" indicate that /P should be used (e.g., ^^XYZ or ^^/XYZ means /P/XYZ). Three "^"s, in this example, removes all directories. This is the same as not specifying any pe "^" notation is repetitive, i.e., multiple "^"s may be used to "peel" off layers of directories in a prefix. Again using the previous example, given the file /P/Q/R/S with its prefix /P/Q/R, a single "^" indicates the , but with the final directory component removed. Thus, in our example, if /P/Q/R/S is the input pathname, then ^XYZ or ^/XYZ can be used to refer to the codefile /P/Q/XYZ. The prefix is /P/Q/R, so the single "^" indicates only /P/Q is to be used. Th because it has a common node on the pathname tree. For example, /P/Q/R/S might be the input field and /P/Q/XYZ might be the name for the codefile. For these cases the special prefix character "^" has been provided. The "^" means use the previous prefixthe previous pathname. So, $$ or $/$ means use both the previous file's prefix and suffix. In other words, $/$ is identical to just a single $. In some cases you might want to refer to a file in a different directory from the previous file, but relatedhname, then $XYZ or $/XYZ means /P/Q/R/XYZ. If a "$" or a "/$" is used as a suffix (the filename), you indicate that the preceding file's is to be used. Thus .D1$ or .D1/$ would mean .D1/S assuming /P/Q/R/S was prefix and suffix based on the prefix and suffix of a previous pathname.  By placing a "$" or"$/"at the begining of a filename (with a suffix, e.g., XYZ) you indicate the prefix of the previous file is to be used. Thus, if /P/Q/R/S is the previous patcumentation for a description of the "*" abbreviation. The default prefix when none is explicitly specified with a filename is the "$" notation, which refers to "the previous pathname". ^uw 8  Additionally, we have an abbreviation scheme for both theA pathname may be viewed as having a prefix and a suffix. The prefix is the pathname of the directory containing the desired file, the suffix. Thus, for example, if /P/Q/R/S is the full pathname, /P/Q/R is the prefix, and S its suffix. See the Pascal doo change your mind about a file that was selected, a editing facility is available to make a change. These features are described in the following sections. % ^ne 4 @@PATHNAME SELECTION etermines a prefix and a suffix for the listing file and (you don't get an error file if there is a listing file, and a null response to the listing request does not affect the prefix and suffix determined by the codefile). ^ne 5 @File Selection In