Page 132 - Standard Handbook Of Petroleum & Natural Gas Engineering
P. 132

Computer Applications   117

                                                 Table  1-25
                                     Precedence of  FORTRAN Operators
                          Class                Level             Symbol or  Mnemonic
                      EXPONENTIAL             First            tt
                                              Second           - (negation)  and + (identity)
                      ARITHMETIC             Third             *, 1
                                              Fourth           +, -
                      RE L AT I 0 N A L       Fifth             .GT.,.GE.,.LT.,.LE.,.EQ.,.NE
                                              Sixth             .NOT.
                                              Seventh           .AND.
                      LOGICAL
                                              Eighth            .OR.
                                              Ninth             .EQV. ,.NEQV


                    where  device# refers  to either a device  such as a screen or printer  or to a  disk
                    file.  Usually  the  default  input  device  (referenced by  an  asterisk  rather  than  a
                    device#) is  the  keyboard  and  the default  output  device  (also referenced  by  an
                    asterisk) is  the  screen.  PRINT  connects only  to  the  printer.  Other devices and
                    files  may  be  assigned  device  numbers  through  file  handling  statements  (see
                    later). A  statement  requesting  list-directed  input  from  the  default  device  (the
                    keyboard) might  be,  for  example,
                      READ( ",")TEMP,PRSSR,LENGTH

                      Formatted 1/0  statements require  edit specifiers (see Table  1-26 for list) for
                    each variable to be handled and may also include strings of  characters enclosed
                    in  single quote marks. The format may be given  in  a separate format statement
                    (referenced by  a line number and labeled) or, in many systems, may be enclosed
                    in  quotes  and  parentheses  in  the  1/0  statement  itself.  The  general  form  for
                    formatted  1/0  statements  is
                           READ(device#,label)varl,var2, . . .
                           WRITE(device#,label)varl,var2,  . . .
                           PRINT  label varl,varZ, . . .
                      label  FORMAT(1ist of  specifications)
                    For  example,

                          READ(  *, lOO)X( l),Y,I
                      100 FORMAT( lX,2F12.4,15)
                          WRITE(6,l lO)(TEMP(I),I  =  1,5)
                      110 FORMAT( lX,5(F7.3,2X))
                          WRITE(  *,'( "TEMP AT  SURFACE IS  ",FS.S)')TSURF
                      File  handling  statements  allow  the manipulation  of  sequential  and random
                    access  files. (Since there is  considerable  variation from one system  to  the next,
                    the  following  information  is  given  in  general  terms  only.)  Devices  are  treated
   127   128   129   130   131   132   133   134   135   136   137