VMS Help
PASCAL, Input Output, Direct Access

 *Conan The Librarian (sorry for the slow response - running on an old VAX)

  Direct access procedures  are  generally  legal  only  on  files
  opened  for  direct  access.  In some cases, procedures apply to
  keyed access files as well.

  1 - DELETE

  The DELETE procedure deletes the current file component.  DELETE
  can  be used only on files with relative or indexed organization
  that have been opened for direct or keyed access; it  cannot  be
  used on files with sequential organization.

  Syntax:

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

  The 'file_variable' is the name of the file variable  associated
  with the file from which a component is to be deleted.

  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.

  The file must be in inspection mode before DELETE is called; the
  mode does not change after the procedure's execution.

  When the DELETE procedure is called, the current  component,  as
  indicated by the file buffer, must already have been locked by a
  successful FIND, FINDK, GET, RESET, or RESETK  procedure  before
  it  can  be  deleted.  After deletion, the component is unlocked
  and the UFB function returns TRUE.

  See the "Compaq Pascal Language Reference Manual" for a complete
  description of the DELETE procedure.

  2 - FIND

  The FIND procedure positions a file at  a  specified  component.
  The  file  must  be  open  for  direct  access  and must contain
  fixed-length components.

  Syntax:

     FIND( file_variable, component-number
           [[, ERROR := error-recovery]] );

  The 'file_variable' is the name of the file variable  associated
  with a file that is open for direct access.

  The 'component-number' is a  positive  integer  expression  that
  indicates  the  component at which the file is to be positioned.
  If the component number is zero or negative,  a  run-time  error
  occurs.

  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.

  The FIND procedure allows direct access to the components  of  a
  file.   You  can  use  the  FIND  procedure  to  move forward or
  backward in a file.

  After execution of the FIND procedure, the file is positioned at
  the  specified  component.  The file buffer variable assumes the
  value of the component, and the file mode is set to  inspection.
  If   the  file  has  relative  organization,  the  current  file
  component is locked.  If there  is  no  file  component  at  the
  selected  position,  the  file  buffer is undefined (UFB becomes
  TRUE) and the mode becomes undefined.  After any call  to  FIND,
  the value of EOF is undefined.

  You can use the FIND procedure only when reading a file that was
  opened  by the OPEN procedure.  If the file is open because of a
  default open (that is, with EXTEND, RESET, or REWRITE),  a  call
  to  FIND  results in a run-time error because the default access
  method is sequential.

  See the "Compaq Pascal Language Reference Manual" for a complete
  description of the FIND procedure.

  3 - LOCATE

  The  LOCATE  procedure  positions  a  random-access  file  at  a
  particular  component  so that the next PUT procedure can modify
  that component.

  Syntax:

     LOCATE( file_variable, component-number
        [[, ERROR := error-recovery]] );

  The 'file_variable' is the name of the file variable  associated
  with the file to be positioned.

  The  'component-number'  is  a   positive   integer   expression
  indicating  the relative component number of the component to be
  found.

  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.

  The file can be in any mode before LOCATE is called.   The  mode
  is set to generation after the procedure's execution.

  The LOCATE procedure positions the file so  that  the  next  PUT
  procedure  writes  the  contents  of  the  file  buffer into the
  selected  component.   After  LOCATE  has  been  performed,  UFB
  returns TRUE and EOF is undefined.

  See the "Compaq Pascal Language Reference Manual"  for  complete
  information on the LOCATE procedure.

  4 - UPDATE

  The UPDATE procedure writes the contents of the file buffer into
  the current component.

  Syntax:

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

  The 'file_variable' is the name of the file variable  associated
  with the file whose component is to be updated.

  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.

  The file must be in inspection mode before UPDATE is called;  it
  remains in that mode after the procedure's execution.

  The UPDATE procedure is legal for files that  have  been  opened
  for  random access ("direct" or "keyed").  The current component
  must already have been locked by a successful FIND, FINDK,  GET,
  RESET,  or  RESETK  procedure  before  the  contents of the file
  buffer can be rewritten into it.  After  the  update  has  taken
  place, the component is unlocked and UFB returns TRUE.

  See the "Compaq Pascal Language Reference Manual"  for  complete
  information on the UPDATE procedure.
  Close     HLB-list     TLB-list     Help  

[legal] [privacy] [GNU] [policy] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.