VMS Help  —  CALL  Example
  $
  $! CALL.COM
  $
  $! Define subroutine SUB1
  $!
  $ SUB1: SUBROUTINE
     .
     .
     .
  $ CALL SUB2 !Invoke SUB2 from within SUB1
     .
     .
     .
  $ @FILE  !Invoke another procedure command file
     .
     .
     .
  $ EXIT
  $ ENDSUBROUTINE !End of SUB1 definition
  $!
  $! Define subroutine SUB2
  $!
  $ SUB2: SUBROUTINE
     .
     .
     .
  $ EXIT
  $ ENDSUBROUTINE !End of SUB2 definition
  $!
  $! Start of main routine. At this point, both SUB1 and SUB2
  $! have been defined but none of the previous commands have
  $! been executed.
  $!
  $ START:
  $ CALL/OUTPUT=NAMES.LOG SUB1 "THIS IS P1"
     .
     .
     .
  $ CALL SUB2 "THIS IS P1" "THIS IS P2"
     .
     .
     .
  $ EXIT  !Exit this command procedure file

      The command procedure in this example shows how to use the CALL
      command to transfer control to labeled subroutines. The example
      also shows that you can call a subroutine or another command
      file from within a subroutine.

      The CALL command invokes the subroutine SUB1, directing output
      to the file NAMES.LOG and allowing other users write (W) access
      to the file. The subroutine SUB2 is called from within SUB1.
      The procedure executes SUB2 and then uses the @ (execute
      procedure) command to invoke the command procedure FILE.COM.

      When all the commands in SUB1 have executed, the CALL command
      in the main procedure calls SUB2 a second time. The procedure
      continues until SUB2 has executed.
Close Help