VMS Help  —  PASCAL  Input Output, Text File
  Text  file  manipulation  routines  apply  only  to  text  files
  (including INPUT, OUTPUT, and ERR).

1  –  EOLN

  The EOLN function tests for the end-of-line marker within a text
  file and returns a Boolean value.

  Syntax:

     EOLN [[( file_variable )]]

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

  The file must be in inspection mode and EOF  must  return  FALSE
  before EOLN is called.  EOLN leaves the file in inspection mode.

  The Boolean EOLN function returns TRUE when the file pointer  is
  positioned  after  the  last character in a line.  When the EOLN
  function  returns  TRUE,  the  file  buffer  contains  a   blank
  character.

  The EOLN function returns FALSE when the last component  in  the
  line  is  read  into the file buffer.  Another character must be
  read to cause EOLN to return TRUE and to cause the  file  buffer
  to  be  positioned  at the end-of-line marker following the last
  character of the line.  If  you  use  the  EOLN  function  on  a
  nontext file, an error occurs.

  See the "HP Pascal Language Reference  Manual"  for  a  complete
  description of the EOLN function.

2  –  LINELIMIT

  The LINELIMIT procedure stops execution of the program  after  a
  specified number of lines has been written into a TEXT file.

  Syntax:

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

  The 'file_variable' is the name of the file variable  associated
  with the TEXT file to which the limit applies.

  The 'n' is a positive  integer  expression  that  indicates  the
  number of lines that can be written to the file before execution
  terminates.

  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 LINELIMIT is called; the file
  mode does not change after LINELIMIT has been executed.

  VSI Pascal first uses environment-specific means to determine if
  there   is   a   default   line   limit.    If   there   is  not
  environment-specific default, there is no  default  line  limit.
  You can use a call to LINELIMIT to override the default.

  After the number of lines written into the file has reached  the
  line  limit,  program  execution  terminates  unless the WRITELN
  procedure that exceeded the line limit  includes  the  ERROR  :=
  CONTINUE parameter.

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

3  –  PAGE

  The PAGE procedure skips from the current page to the next  page
  of a TEXT file.

  Syntax:

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

  The 'file_variable' is the name of the file variable  associated
  with a TEXT 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.

  The file must be in generation mode before the PAGE procedure is
  called;  the mode does not change as a result of the procedure's
  execution.

  Execution of the PAGE procedure clears the record buffer, if  it
  contains  data,  by  performing  a  WRITELN  procedure, and then
  advances the output to a new page of the  specified  TEXT  file.
  The  next component written to the file begins on the first line
  of a new page.  You can use this procedure only on  TEXT  files.
  If you specify a file of any other type, an error occurs.

  The value of the page eject component that is output to the file
  depends  on  the  carriage  control  format for that file.  When
  CARRIAGE or  FORTRAN  is  enabled,  the  page  eject  record  is
  equivalent  to  the  carriage control character '1'.  When LIST,
  NOCARRIAGE, or NONE is enabled,  the  page  eject  record  is  a
  single form feed character.

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

4  –  READLN

  The READLN procedure reads lines of data from a TEXT file.

  Syntax:

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

  The 'file_variable' is the name of the file variable  associated
  with  the  TEXT  file  to  be read.  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.  If you do not specify any  variable  name,
  READLN skips a line in the specified file.

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

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

  The READLN procedure reads  values  from  a  TEXT  file.   After
  reading   values  for  all  the  listed  variables,  the  READLN
  procedure skips over any characters  remaining  on  the  current
  line  and  positions the file at the beginning of the next line.
  The values need not all be on a single  line;  READLN  continues
  until  values have been assigned to all the specified variables,
  even if this process results in the reading of several lines  of
  the input file.

  EOLN returns TRUE after a READLN procedure only if the new  line
  is empty.

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

5  –  WRITELN

  The WRITELN procedure writes a line of data to a text file.

  Syntax:

     WRITELN [[( [[file_variable,]] {expression},...
        [[, ERROR := error-recovery]] )]]

  The 'file_variable' is the name of the file variable  associated
  with  the  text file to be written.  If you omit the name of the
  file, the default is OUTPUT.

  The 'expression' is an expression whose value is to be  written;
  multiple  output  values  must  be  separated  by  commas.   The
  expressions can be of any ordinal, real, or string type and  are
  written with a default field width.

  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 generation mode before WRITELN is called; it
  remains in that mode after WRITELN has been executed.

  The WRITELN procedure writes the specified values into the  TEXT
  file, inserts an end-of-line marker after the end of the current
  line, and then positions the file at the beginning of  the  next
  line.

  You can specify a carriage-control character as the  first  item
  in  an  output  line.  When you use carriage-control characters,
  make sure that the file is open  with  either  the  CARRIAGE  or
  FORTRAN option.

  If you specify a carriage format but  use  an  invalid  carriage
  control  character,  the first character in the line is ignored.
  The output appears with the first character truncated.

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