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

Computer Applications   129

                     WRITE(filename, a,b,c,d);
                   can  then write  four items  to  the file.
                     RESET(fi1ename);-Prepares  a  file  for  reading,  beginning with  the  first  item
                   in  the file,  and
                     READ(filename,X);
                   can  then  read  the first  item  from  the file.
                     Control statements-Affect  the flow of statement execution within a program
                   unit  (see subprogram statements  below  for  passing  of  control  between  units).
                   The only  general  control  statement  in  Pascal  (which is  rarely  needed) is:
                     GOT0 line  number;-Shifts  control  to  the  statement  beginning  at  the
                   specified  line  number.

                     Conditional statements may be nested with  other conditional statements and/
                   or with  iterative statements.  They  are:

                     IF boolean  statement THEN  statement-Where statement  may  be  a  simple or
                   a  compound statement  (for boolean  and  relational  operators,  see  Table  1-29)
                   and

                     IF  boolean  statement
                       THEN  statement  1
                       ELSE  statement  2-where  the statements  are  as  defined  above

                   For  example,
                     IF  (PRSSR <  MINP) OR (PRSSR   MAXP) THEN
                       BEGIN
                         X(P1PENUM:  =  PREVX;
                          CORRPR( PRSSR,X( PIPENUM),AVT)
                       END
                     ELSE
                          PREVX:  =  X(IP);

                   and
                     CASE  selector  expression  OF
                           label:  statement;
                           label:  statement;
                                 ...
                           label:  statement
                     END
                   where,  when  the  selector  expression  is  evaluated,  producing  an ordinal  value,
                   the  statement  following the  label  value  which  matches  the  selector  expression
                   is  executed,  e.g.,
                     CASE  PIPENUM  OF
                            1:  PREV:  =  FALSE;
                       MAXP:  NEXT  = FALSE
                     END:
   139   140   141   142   143   144   145   146   147   148   149