VMS Help  —  PASCAL  Input Output, Seq Access Input
  The sequential access input procedures are  procedures  used  on
  files opened for sequential access, but they can also be used on
  files opened for direct and keyed access.

1  –  GET

  The GET procedure advances the file position and reads the  next
  component  of  the  file  into the file buffer variable.  If the
  file has relative or indexed organization, the component is also
  locked to prevent access by other processes.

  Syntax:

     GET( file_variable [[,ERROR := error-recovery]] );

  The 'file_variable' is the name associated with the input file.

  The 'error-recovery' specifies the action  to  be  taken  if  an
  error occurs during execution of the routine.  By default, after
  the first error, the error message is printed and  execution  is
  stopped.

  Before the GET procedure is used for the first time to read  one
  or more file components, the file must be in inspection mode and
  prepared for reading input.   Depending  on  the  access  method
  specified when the file was opened, you can prepare the file for
  input in the following ways:

   o  If the file is open for sequential access,  call  the  RESET
      procedure.   RESET sets the mode to inspection, advances the
      file position  to  the  first  component,  and  assigns  the
      component's value to the file buffer variable.

   o  If the file is open for direct access, call either the RESET
      or the FIND procedure to position the file.

   o  If the file is open for keyed access, call the FINDK, RESET,
      or RESETK procedure to position the file.

  As a result of the GET procedure, the file remains in inspection
  mode,  and the file position advances to the next component.  If
  a component is found other  than  the  end-of-file  marker,  the
  component  is  locked,  EOF  is  set  to  FALSE, the file buffer
  variable takes on the value of the component, and UFB is set  to
  FALSE.   If  a  component is not found or the end of the file is
  reached, EOF and UFB are set to  TRUE.   If  the  GET  procedure
  fails, UFB is set to TRUE and EOF becomes undefined.

  See the "HP Pascal Language Reference Manual" for  the  complete
  description of the GET procedure.

2  –  READ

  The READ procedure reads one or  more  file  components  into  a
  variable.

  Syntax:

     READ( [[file_variable,]] {variable-identifier
        [[:radix-specifier]]},... [[, ERROR := error-recovery]] );

  The 'file_variable' is the name associated with the input  file.
  If you omit the name of the file, the default is INPUT.

  The 'variable-identifier' is the name of the variable into which
  a   file  component  will  be  read;  multiple  identifiers  are
  separated by commas.

  The 'radix-specifier' is one of the format values BIN,  OCT,  or
  HEX.   These  values,  when  used on a variable identifier, will
  read  the  variable  in  binary,  octal,  or  hexadecimal  radix
  respectively.   You  can use a radix specifier only when reading
  from a TEXT file.

  The 'error-recovery' is the action  to  be  taken  if  an  error
  occurs  during  execution of the routine.  By default, after the
  first error, the error  message  is  printed  and  execution  is
  stopped.

  The file must be in inspection mode before READ is called.   The
  file  remains  in  inspection  mode  after  execution  of a READ
  procedure.

  By definition, the READ procedure for a nontext file performs an
  assignment  statement,  a GET procedure, and an UNLOCK procedure
  for each variable.

  The READ procedure reads from the file  until  it  has  found  a
  value  for  each  variable in the list.  The first value read is
  assigned to the first variable in the  list,  the  second  value
  read  is assigned to the second variable, and so on.  The values
  and  the  variables  must  be  of  assignment-compatible  types.
  Reading stops if an error occurs.

  For a TEXT file, more than one component (character) can be read
  into  a  single  variable.   For example, many characters can be
  read into a string or converted into a  numeric  variable.   The
  READ  procedure  repeats the assignment, GET, and UNLOCK process
  until it has read a sequence  of  characters  that  represent  a
  legal  value  for  the next variable in the parameter list.  The
  procedure continues to read components from the  file  until  it
  has assigned a value to each variable in the list.

  See the "HP Pascal Language Reference  Manual"  for  a  complete
  description of the READ procedure.

3  –  RESET

  The RESET procedure readies a file for reading.

  Syntax:

     RESET( file_variable [[, file_name]]
            [[, ERROR := error-recovery]] );

  The 'file_variable' is the name of the file variable  associated
  with  the input file.  You do not need this argument if the file
  was opened with the OPEN procedure.

  The  'file_name'  represents  the  string   expression   to   be
  associated with the 'file_variable'.  If the file was previously
  opened with the OPEN procedure, 'file_name' is ignored.

  The 'error-recovery' represents the action to  be  taken  if  an
  error occurs during execution of the routine.  By default, after
  the first error, the error message is printed and  execution  is
  stopped.

  The file can be in any mode before you call  RESET;  a  call  to
  RESET  sets  the  file  to  inspection  mode.  If the file is an
  external file and is not already open, RESET opens it using  the
  same  defaults  as  the OPEN procedure.  You cannot use RESET to
  create a file.

  After execution of RESET, the file is positioned  at  the  first
  component,  and  the  file buffer variable contains the value of
  this component.  If the file is not empty, EOF  and  UFB  return
  FALSE  and  the  first  component is locked to prevent access by
  other processes.  If the file is empty, EOF and UFB return TRUE.
  If  the  file  does  not  exist,  RESET  does not create it, but
  returns an error at run time.

  You should call RESET before reading any  file  with  sequential
  organization  except  the  predeclared  file  INPUT.   The RESET
  procedure removes the end-of-file marker from any file connected
  to  a  terminal  device (including INPUT), thus allowing reading
  from  the  file  to  continue.   If  you  call  RESET  for   the
  predeclared file OUTPUT, an error occurs.

  A call to RESET on a relative  file  opened  for  direct  access
  positions the file at its first existing component.

  A call to RESET on an  indexed  file  opened  for  keyed  access
  positions  the  file  at  the  first  component  relative to the
  primary key.

  See the "HP Pascal Language Reference  Manual"  for  a  complete
  description of the RESET procedure.
Close Help