CMS EXEC
Appearance
| Company type | Scripting language |
|---|---|
| Industry | Computer software |
| Founded | 1966 |
| Founder | Stuart Madnick |
| Products | CMS EXEC scripting language |
CMS EXEC, often referred to simply as EXEC, is a command procedure control scripting language interpreted by the CMS EXEC Processor within the IBM Virtual Machine/Conversational Monitor System (VM/CMS) environment.
Created in 1966 by Stuart Madnick at MIT, EXEC was inspired by the CTSS RUNCOM. Originally called COMMAND, it was subsequently renamed EXEC.
EXEC has been followed by successors such as EXEC 2 and REXX, all of which continue to be supported under IBM's CMS offerings.
The EXEC language
- Lines processed by EXEC can be up to 130 characters when entered via terminal or 72 characters when read from a file.
- A label, consisting of a dash followed by up to seven alphanumeric characters, may precede CMS commands or EXEC control statements.
- Commands are divided into tokens separated by spaces, each token limited to eight characters.
- Variables start with an ampersand and include up to seven alphanumeric characters; these may be either user-defined or special predefined EXEC variables.
- During parsing, tokens containing variables are substituted with their corresponding values.
- Lines beginning with an asterisk in the first column are treated as comments; all other lines are considered executable statements.
- Lines with no content are classified as null statements.
- Lines that do not start with an asterisk or ampersand are interpreted as CMS commands and executed directly by CMS.
- Assignment statements assign values to variables using the syntax
&variable = <arithmetic-expression>. - Control statements commence with an EXEC control keyword followed by a token that is not an equals sign.
- The set of EXEC control words includes:
- &ARGS - redefines the command arguments.
- &BEGPUNCH - initiates lines to be sent to the user's virtual punch device.
- &BEGSTACK - starts lines that will be added to the user's console input stack.
- &BEGTYPE - begins lines typed directly on the user's terminal.
- &END - terminates &BEGPUNCH, &BEGSTACK, or &BEGTYPE blocks.
- &CONTINUE - processes the subsequent line from the file.
- &CONTROL - manages how messages are displayed.
- &ERROR - specifies error handling procedures.
- &EXIT - terminates the current EXEC script, optionally returning a status code.
- &GOTO - directs execution flow within the EXEC file (to TOP, a label, or line number).
- &IF - enables conditional execution paths.
- &LOOP - repeats statement blocks until specified conditions are met.
- &PUNCH - outputs tokens as virtual punch cards, adjusting length as necessary.
- &READ - accepts input lines from the user's terminal.
- &SKIP - bypasses a defined number of lines.
- &SPACE - prints blank lines on the terminal display.
- &STACK - inserts constructed lines into the input stack similarly to &PUNCH.
- &TIME - defines timing information shown after CMS commands execute.
- &TYPE - outputs constructed lines on the user's terminal screen.
- Among its built-in functions are:
- &CONCAT which joins tokens together.
- &DATATYPE which determines if tokens are numeric or alphabetic.
- &LENGTH which returns the length of tokens.
- &LITERAL which prevents variable substitution within a token.
- &SUBSTR which extracts substrings from tokens.
Sample code
A PROFILE EXEC is an EXEC script automatically run when a user logs in, allowing environment customization. Below is a simple example of PROFILE EXEC:
* Issues CMS commands to set * the "blip" character to an asterisk and request * short format for system ready messages. &CONTROL OFF SET BLIP * SET RDYMSG SMSG