CMS EXEC, or EXEC, is an interpreted, command procedure control, computer scripting language used by the CMS EXEC Processor supplied with the IBM Virtual Machine/Conversational Monitor System (VM/CMS) operating system.
Stuart Madnick wrote EXEC for Cambridge Monitor System (CMS) under CP-67 in 1966 at MIT on the model of CTSS RUNCOM. He originally called this processor COMMAND, and it was later renamed EXEC.
CMS EXEC has been superseded by EXEC 2 and REXX. All three â CMS EXEC, EXEC 2 and REXX â continue to be supported by the IBM CMS product.
The EXEC language
- EXEC processes lines up to 130 characters long when entered from a terminal, or by default 72 characters when read from a file.
- A label consisting of a dash followed by up to seven alphanumeric characters can prefix a CMS command or an EXEC control statement.
- The interpreter parses commands into blank-delimited tokens of up to eight characters each.
- Variables consist of an ampersand followed by up to seven alphanumeric characters. Variables can be either user-defined variables or pre-defined ("special") EXEC variables.
- As each line is read the tokens are scanned. If they contain EXEC variables the variables are replaced by their value.
- Comments. Comments in EXEC files begin with an asterisk in column one. All other statements are executable statements.
- Null statements. A null statement contains no data items.
- CMS commands. If the first data item on a line is not an asterisk or ampersand the EXEC processor considers the line to be a CMS command and passes it to CMS for immediate execution.
- Assignment statements. An assignment statement assigns a value to an EXEC variable. It has the form <code>&variable = <arithmetic-expression></code>
- Control statements. A statement where the first data item is an EXEC control word and the second is not an equals sign is assumed to be a control statement.
- EXEC control words:
- &ARGS â allows the user to redefine command arguments.
- &BEGPUNCH â heads a series of lines to be spooled to the user's virtual punch.
- &BEGSTACK â heads a series of lines to be placed in the user's console input stack.
- &BEGTYPE â heads a series of lines to be typed on the user's terminal.
- &END â marks the end of the lines processed by &BEGPUNCH, &BEGSTACK, or &BEGTYPE.
- &CONTINUE â tells the interpreter to process the next line in the file.
- &CONTROL â controls the format in which messages are displayed.
- &ERROR â tells the interpreter what to do if an error is detected.
- &EXIT â exits the current EXEC file, and optionally sets a return code.
- &GOTO â branches to another location in the current EXEC file. The location can be TOP for the beginning of the file, a label, or a line number.
- &IF â allows for conditional execution of statements.
- &LOOP â heads a group of statements to be executed multiple times, or until a specified condition is true.
- &PUNCH â sends a string of tokens to the user's virtual punch. Each &PUNCH statement generates one card-image, padded or truncated if necessary.
- &READ â reads one or more lines from the user's terminal.
- &SKIP â skips (ignores) a specified number of lines.
- &SPACE â types a specified number of blank lines on the user's terminal.
- &STACK â places one line in the user's input stack. The line is constructed from tokens as for &PUNCH.
- &TIME â specifies what timing information is to be typed on the user's terminal following the execution of each CMS command.
- &TYPE â types a line on the user's terminal. The line is constructed from tokens as for &PUNCH.
- Built-in functions. The EXEC interpreter provides a few "built-in" or predefined functions:
- &CONCAT â concatenates a string of tokens.
- &DATATYPE â examines a token and determines whether it is numeric or alphabetic.
- &LENGTH â returns the length of a token.
- &LITERAL â prevents variable substitution within a token.
- &SUBSTR â extract selected characters from a token.
Sample code
PROFILE EXEC is an EXEC that is automatically executed when a user logs on to tailor their environment. A simple PROFILE EXEC might look like the following: <pre>
- The following code issues CMS commands to set
- the "blip" character to asterisk and request
- the "short" format for system ready messages.
&CONTROL OFF SET BLIP * SET RDYMSG SMSG </pre>
Related CMS Command Procedure Control Languages
Notes
References
External links