March 30, 1979 MODIFYING CMS EXECS A CMS EXEC is like any other CMS file; you can edit it, erase it, rename
it, or change it. If you have created it to catalog a particular group
of files, you might want to rename it; each time you use the LISTFILE
com.and with the EXEC option a CMS EXEC is created, and any old CMS EXEC is erased. To rename it, you can use the CMS RENAME command, or, if you
are editing it, you can rename it when you file it:
edit cms exec
input &ccntrol off
file prfile exec You might also want to edit a CMS EXEC to provide it with more
numeric variables; for example:
edit CIIS exec
input &ccntrol off
input cp spool printer class s cont
change lal/a1 &3 &4 &5 &61 *
input cp spool printer nocont
input cp close printer
file prfile exec
prfile print % (cc When this EXEC is executed, the variable &1 is substituted with PRINT,
the variable &2 is set to a null string (the special character % indicates that you are not passing an argument to it), and &3 and &4 are
set to the PRINT command option (CC, so that the files in the EXEC print
with carriage control. The CP commands that are inserted ensure that
the files print as a single spool file, and not individually.
Summary of the EXEC Language Facilities The EXEC processor, or interpreter, recognizes keywords that begin with
the special character ampersand (&). Keywords may indicate: Control statements Built-in functions Special variables Arguments You may also define your own variables in an EXEC file; the EXEC interpreter can process them as long as they begin with an a.persand.
The following pages briefli discuss the kinds of things you can do with
an EXEC, introduce you to the control statements, built-in functions,
and special variables, and give some examples of how to use the EXEC processor. If you want more information on writing EXEC procedures, see "Part 3. Learning To Use EXEC." For specific information on the format
and usage rules for any EXEC statement or variable, consult the In general the following rules apply to entering lines into an EXEC procedure:
1. Most input lines (with a few exceptions) are scanned during
execution of the EXEC. Every word on a line is padded or truncated 100 IBM VM/370 CMS User's Guide
to fit into an eight-character enter the EXEC control statement:
&type today is wednesday So, for example, if you
when this EXEC is executed, the line is disFlayed at your terminal: TODAY IS WEDNESDA The lines that are not tokenized are those that begin with an *
(and are considered comments), and those that follow an &BEGE!SG. &BEGPUNCB, &BEGSTACK, or &BEGTYPE control statement, up to an &END
statement.
2. You can enter input lines beginning in any column. The only time that you must enter an EXEC line beginning in column 1 is when you
are using the &END control statement to terminate a series of lines
being punched, stacked, or typed. ARGUMENTS AND VARIABLES Most EXEC processing is contingent on the value of variable expressions.
A variable expression in an EXEC is a symbol that begins with an
ampersand (&). When the EXEC interpreter processes a line and
encounters a variable symbol, it substitutes the variable with a
predefined value, if the symbol has been defined. Symbols can be defined in three ways: (1) when passed as arguments to the EXEC, (2) by assignment statements, (3) interactively, as a result of a &REaD ARGS or &READ VARS control statement. You can pass arguments to EXEC files when you invoke them. Each
argument you enter is assigned a variable name: the first argument is
&1, the second is &2, the third &3, and so on. You can assign values
for up to 30 variables this way. For example, if an EXEC is invoked:
scan alpha 2 notype print
the variable &1 has a value of ALPHA, the variable &2 has a value of 2,
&3 is NOTYPE and &4 is PRINT. These values remain in effect until you
change them@ You can test the arguments passed in several ways. The special
variable &INDEX contains the number of arguments received. Using the
example SCAN ALPHA 2 NOTYPE PRINT, the statement:
&IF &INDEX EQ 4 &GOTO -SET would be true, since four arguments were entered, so a branch to the
label -SET is taken. You can change the values of arguments or assign values using the &IRGS control statement. For example:
&IF &INDEX EQ 0 &ARGS ABC
assigns the values A, B, and C to the variables &1, &2, and &3 when the EXEC is invoked without any arguments. Use the &READ ARGS control statement to enter arguments
interactively. For example, if your EXEC file contains the line:
&READ ARGS Section 6. Introduction to the EXEC Processor 101
Previous Page Next Page