266 IBM VM/370 eMS User's Guide
Section 14. Building EXEC Procedures
This section discusses various techniques that you can use when you
write EXEC procedures. The examples are intended only as suggestions:
you should not feel that they represent either the only way or the best
way to achieve a particular result. 8any combinations and variations of
control statements are possible; in most cases, there are many ways to
do the same thing.
This secticn is called "Building EXEC Procedures" because you will often find that once you have created an EXEC procedure and begun to use
it, you continually think of new applications or new uses for it. Using
the C8S editor, you may quickly build the additions and make the
necessary changes. You are encouraged to develop EXEC procedures to help
you in all the phases of your C8S work.
What Is a Token?
An executable statement is any line in an EXEC file that is processed by
the EXEC interpreter, including: CMS command lines EXEC control statements
Assignment statements ,-y _." ,.: --- JJU.J..J. Executable statements may appear by themselves on a line or as the object of another executable statement, for example in an &IF or &LOCP control statement. If you want to execute CP commands or other EXEC procedures in an EXEC, you must use the CP and EXEC commands, respectively. CP commands are passed directly to CP for processing.
All executable statements in an EXEC are scanned by the CMS scan
routine. This routine converts each word (words are delimited by blanks
and parentheses) into an eight-character quantity called a token. If a
word contains more than eight characters, it is truncated on the right.
If it contains fewer than eight characters, it is padded with blanks. When a parenthesis appears on the line, it is treated both as a
delimiter and as a token. For example, the line: &TYPE WHAT IS YOUR PREFERENCE (REDIBLUE)? scans as follows: &TYPE WHAT IS YOUR PREFEREN ( REDIBLUE ) ? After a line has been scanned, each token is scanned for ampersands
and substitutions are performed on any variable symbols in the tokens
before the statement is executed. After elimination of any null
variables, the statement may contain a maximum of 32 tokens.
Nonexecutable statements are lines that are not processed by the EXEC interpreter, that is, comment lines (those that begin with an *), and
data lines following an &BEGE8SG, &BEGPUNCH, &BEGSTACK, or &BEGTYPE control statement. Since these lines are not scanned, words are not
truncated, and tokens are neither formed nor substituted.
Since all executable statements in an EXEC are scanned, and the data
items are treated as tokens, the term "token" is used throughout this
Section 14. Building EXEC Procedures 267
Previous Page Next Page