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

Computer Applications   119

                     CLOSE(1ist of  specifiers)-Disconnects  a  file. The specifiers  may  be:
                     UNIT  =   file unit  (device) number
                     IOSTAT    as in  OPEN
                     ERR       as in  OPEN
                     STATUS    may  be  KEEP  or DELETE

                     INQUIRE(1ist  of specifiers)-Returns information  about the attributes of  a file.
                   Besides  the UNIT  = , IOSTAT  and ERR  specifiers, the following specifiers may
                   be included:

                     EXIST        returns  .TRUE.  if  file exists, else  .FALSE.
                     OPENED       returns  .TRUE.  if  open, else  .FALSE.
                     NUMBER       returns  number  of  connected  device
                     NAMED        returns  .TRUE.  or .FALSE.
                     NAME         returns  name  of  file
                     FORM         returns  FORMATTED  or UNFORMATTED
                     RECL         returns  record  length in direct access  file
                     NEXT  REC    returns  number of  next  record  in  direct  access  file
                     BLANK        returns  whether  blanks  or zeros  specified

                   The following statements must include the UNIT = and may include the IOSTAT
                   and/or  the ERR  specifiers:
                      REWIND(1ist of  specifiers)   - Causes  a  sequential  file  to  be  rewound  to
                                                  first  record
                      BACKSPACE(1ist of  specifiers)  - Causes a sequential file to rewind one record
                      ENDFILE(1ist of  specifiers)   - Places  an end-of-file mark  on a  sequential
                                                  file

                   A  few  examples of  file-handling statements  are:
                     OPEN(UN1T = 6,IOSTAT = FSTAT,FILE  =  ‘PRINTER’,STATUS =  ‘NEW’
                     OPEN(4,FILE = ‘DATAl’,STATUS =  ‘OLD’)
                     CLOSE(6)
                      BACKSPACE(4,ERR = 500)


                     Control statements affect the flow of instructions within  a program  unit.   For
                   control between units, see subprogram  statements later.) These may be general,
                   conditional, or iterative statements.  General  control  statements  are:

                     PAUSE  n-Interrupts  program  run,  resumption  upon  pressing  “Enter”; n  is
                   an  optional  character  constant  or integer of  less  than 5 digits, e.g.,
                     PAUSE  ‘VALUE INVALID’
                     STOP n-Halts  program  run (n as  above)
                     STOP  10050
                     GOTO  i-Transfers  control  to  statement  labeled  i,  where  i  is  an  integer
                   constant  or variable  with  value  of  label, e.g.,
                      GOTO 700
   129   130   131   132   133   134   135   136   137   138   139