Command Procedure

From VSI OpenVMS Wiki
Jump to: navigation, search

A command procedure is a file that holds a sequence of DCL commands to be executed by the system in sequence interactively or as a batch job - essentially a DCL script. Command procedure files have the extension of .COM (this is not required; however, this is the default file type for interactive command procedure execution.

Rules

The following is required for OpenVMS command procedures: 1. Every line in a command procedure that is not a data line has to begin with the dollar sign ($):

$ if f$mode() .nes. "INTERACTIVE" then exit
 

2. Comments begin with an exclamation point (!). Comment lines begin with a dollar sign AND an exclamation point ($!):

$ if count .eq. 5 !Last element
$! Return to the previous level
 

Example

$! This command procedure displays a message based on the current day of the week.
$ say := write sys$output
$ day = f$cvtime(,,"WEEKDAY")
$! show sym day
$ say "Hooray, it's ''day'!"
 

Command procedures used by OpenVMS