VMS Help  —  PASCAL  Input Output, Seq Access Output, PUT
  The PUT procedure adds a new component to a file.

  Syntax:

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

  The 'file_variable' specifies the  name  of  the  file  variable
  associated with the output file.

  The 'error-recovery' is the action  to  be  taken  if  an  error
  occurs during execution of the routine.

  Before executing the first PUT procedure on a  file  opened  for
  sequential  access,  you  must  execute  an  EXTEND,  REWRITE or
  TRUNCATE procedure to set the file to generation mode.   EXTEND,
  REWRITE  and  TRUNCATE  set EOF to TRUE, thus preparing the file
  for output.  (TRUNCATE is legal only on  files  with  sequential
  organization.)   If  the  file  has  indexed  organization,  the
  components to be written must be ordered by the primary key.

  Before executing the first PUT statement on a  file  opened  for
  direct  access,  you  must  execute an EXTEND, REWRITE or LOCATE
  procedure to position the file.

  The PUT procedure writes the value of the file  buffer  variable
  at  the  end  of  the specified sequential-file or direct-access
  file.  You can use LOCATE to position a direct-access  file  and
  then  use  PUT to write the value of the file buffer variable at
  that position.  After execution of the PUT procedure, the  value
  of  the  file  buffer  variable  becomes  undefined (UFB returns
  TRUE).  EOF remains TRUE and  the  file  remains  in  generation
  mode.

  You  can  call  the  PUT  procedure  for  a  keyed-access  file,
  regardless  of  the  file's  mode  (inspection,  generation,  or
  undefined).  PUT causes the file buffer variable to  be  written
  to  the  file  at  the  position  indicated  by the key.  If the
  component has more than one key, the  file  buffer  variable  is
  inserted  in  each  index  at  the  appropriate location.  After
  execution of PUT, a keyed-access file is in generation mode.

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