VMS Help  —  PASCAL  Compilation Units
  A compilation unit is a unit of VSI  Pascal  code  that  can  be
  compiled independently; the term refers to either a program or a
  module.  Both programs and modules have declaration sections but
  only  programs  have  executable  sections.   A  program  can be
  compiled, linked, and run by itself,  but  a  module  cannot  be
  executed  unless  it  is  linked  with a main program written in
  PASCAL, or another  language.   A  module  may  contain  routine
  declarations  but  these  cannot  be executed independently of a
  program.

1  –  PROGRAM

  A program is a set of instructions  that  can  be  compiled  and
  executed by itself.

  Syntax:

     [[attribute-list]]
     PROGRAM comp-unit-identifier [[({file-identifier},...)]];
       [[declaration-section]]
       BEGIN
       {statement};...
       END.

  The 'attribute-list' is one or  more  identifiers  that  provide
  additional information about the compilation unit.

  The 'comp-unit-identifier' specifies the name  of  the  program.
  The  identifier  appears  only  in  the heading and has no other
  purpose within the compilation unit.

  The 'file-identifier' specifies the names of any file  variables
  associated with the external files used by the compilation unit.

  The 'declaration-section' is a VSI Pascal declaration section.

  The 'statement' is any VSI Pascal statement.

  The program  heading  includes  all  information  preceding  the
  program  block.   If  your  program contains any input or output
  routines, you must list all the external file variables that you
  are  using  in  the  compilation unit's heading.  File variables
  listed in a heading must also be declared locally in the  block,
  except for the predeclared file variables INPUT and OUTPUT.

  The INPUT identifier corresponds to a predefined  external  file
  that  accepts  input  from  the  default  device  (usually, your
  terminal); the OUTPUT identifier  corresponds  to  a  predefined
  external  file that sends output to the default device (usually,
  your terminal).

  If you redeclare INPUT or OUTPUT in a  nested  block,  you  lose
  access to the default input or output devices.

2  –  MODULE

  A module is a set of instructions that can be compiled, but  not
  executed,  by  itself.  Module blocks contain only a declaration
  section and TO BEGIN DO and TO END DO sections.

  Syntax:

     [[attribute-list]]
     MODULE comp-unit-identifier [[({file-identifier},...)]];
       [[declaration-section]]
       [[TO BEGIN DO statement;]]
       [[TO END DO statement;]]
       END.

  The 'attribute-list' is one or  more  identifiers  that  provide
  additional information about the compilation unit.

  The 'comp-unit-identifier' specifies the name  of  the  program.
  The  identifier  appears  only  in  the heading and has no other
  purpose within the compilation unit.

  The 'file-identifier' specifies the names of any file  variables
  associated with the external files used by the compilation unit.

  The 'declaration-section' is a VSI Pascal declaration section.

  The 'statement' is any VSI Pascal statement.

  Each module must  be  in  a  separate  file;  you  cannot  place
  multiple  modules  (or a module and a program) in the same file.
  You can compile modules and a  program  together  or  separately
  (the  syntax  of  compilation  depends  on  the operating system
  command-line interpreter you are using).

  The module syntax of VSI Pascal is slightly different than  that
  of Extended Pascal.  However, the concepts in both languages are
  the same.

  The module heading includes all information preceding the module
  block.   If  your program contains any input or output routines,
  you must list all the external file variables that you are using
  in  the  compilation unit's heading.  File variables listed in a
  heading must also be declared locally in the block,  except  for
  the predeclared file variables INPUT and OUTPUT.

  The INPUT identifier corresponds to a predefined  external  file
  that  accepts  input  from  the  default  device  (usually, your
  terminal); the OUTPUT identifier  corresponds  to  a  predefined
  external  file that sends output to the default device (usually,
  your terminal).

  If you redeclare INPUT or OUTPUT in a  nested  block,  you  lose
  access to the default input or output devices.
Close Help