Command Procedures
This chapter describes the components of command procedures.
1. Control Variables
The following is a list of control variables used in command procedures.
Control Variable | Description |
---|---|
&LASTCC |
Recent return codes. The following describes command procedures' unique return codes and their meanings.
|
&MAXCC |
Maximum value of the return code. |
&SYS#CC |
Completion code of a completed job. It is set when an ENDJOBNAME event is raised. |
&SYS#EVENT |
Name of a raised event. This control value has one of the following values.
|
&SYS#EVTNO |
Stores the event that corresponds to the event number specified when an event occurs if multiple values are specified in a single operand in the WAIT command. |
&SYS#FMSG |
Stores the entire outputted message. Set when a MESSAGE event or MSGID event is raised. |
&SYS#JN |
Job name of the completed job. Set when an ENDJOBNAME event is raised. |
&SYS#MSG |
Stores the main text of the outputted message. Set when either a MESSAGE event or an MSGID event is raised. |
&SYS#PFX |
Stores the identifier of the outputted message. Set when either a MESSAGE event or MSGID event is raised. |
&SYSASIS |
|
&SYSCONLIST |
|
&SYSDATE |
Current date in the mm/dd/yy format. |
&SYSDVAL |
String in which the user recently entered to the terminal. |
&SYSENV |
|
&SYSFLUSH |
|
&SYSICMD |
Name of a command procedure. Used only when a command procedure is not executed explicitly by using the EXEC command in an implicit execution. |
&SYSNEST |
|
&SYSPCMD |
A recently executed TSO command (excluding parameters). The default value is EXEC. |
&SYSPREF |
Prefix of the data set name. |
&SYSSCAN |
Specifies the maximum number of times for scanning (the process of substituting a symbol parameter with a value) to be performed before executing each command procedure command. |
&SYSSDATE |
Current date in the yy-mm-dd format. |
&SYSSTIME |
Current time in the hh:mm format. |
&SYSSTOP |
Maximum number of commands that can be executed in a command procedure. |
&SYSSYMLIST |
|
&SYSTIME |
Current time in the hh:mm:ss format. |
&SYSTMID |
Name of the currently connected terminal. |
&SYSUID |
TSO session user ID. |
2. Built-in Functions
The following is a list of the built-in functions used in command procedures.
Built-in Function | Description |
---|---|
&DATATYPE (expr) |
Returns NUM if the result of the expression expr is a number, and returns CHAR if it is a string. |
&EVAL (expr) |
Returns the operation result of the formula expr. |
&LENGTH (expr) |
Returns the character length of the operation result of the expression expr. |
&NRSTR (expr) |
Substitutes the symbol parameters of expression expr, but returns the results without a superposition substitution. Does not execute mathematical operations. |
&STR (expr) |
Substitutes the symbol parameters of expression expr and returns the result of processing built-in functions. Does not execute mathematical operations. |
&SUBSTR (from:to,str) |
Returns the substring extracted from the "from" position to the "to" position of the string str. Only extracts one character from the "from" position if "to" is omitted. |
&SYS#EPRM (eprm) |
Returns the value of the virtual parameter eprm. For information about virtual parameter configuration, refer to Chapter 1. |
&SYSDSN (d) |
Checks the status of the data set "d", and returns "OK" if in a usable status and returns an error message if otherwise. |
&SYSINDEX (needle,haystack,start) |
Returns the position of the string needle in the string haystack. Finds the needle in the entire haystack if "start" is "0" or omitted. If "start" is a positive number, then finds the needle from the starting character of the haystack. Returns 0 if the needle is not found. |
&SYSNSUB (level,expr) |
Substitutes the symbol parameter of the expression expr, but substitutes it in the maximum level of times. |
3. Operators
Expressions can be used in some command procedures such as the IF command. An expression is a concatenation of operands such as integers, strings, symbol parameters, control variables, or built-in functions using operators.
Operators are categorized into arithmetic operators, comparison operators, and logical operators. The following tables describe each type.
-
Arithmetic Operators
Arithmetic Operators Description +
Addition
-
Subtraction
*
Multiplication
/
Division
**
Exponent (if the right side is negative, then the result of the operation is 0)
//
Remainder
-
Comparison Operators
Comparison Operator Description EQ or =
The left side and the right side are the same.
NE or ^=
The left side and the right side are not the same.
LT or <
The left side is smaller than the right side.
GT or >
The left side is greater than the right side.
LE or <=
The left side is less than or equal to the right side.
GE or >=
The left side is greater than or equal to the right side.
NG or ^>
The left side is not greater than the right side.
NL or ^<
The left side is not smaller than the right side.
-
Logical Operators
Logical Operator Description AND or &&
Logical product
OR or |
Logical sum
4. Command Procedure Commands
The following table describes the types of command procedure commands and their functions.
Command Procedure Command | Description |
---|---|
Sets the interrupt handler. For syntax check only. |
|
Closes the data set. |
|
Specifies options related to executing command procedures. |
|
Separates the TSO command and the screen output data area. |
|
Repeatedly executes one or more command procedure commands. |
|
Sets the error handler. |
|
Stops the execution of a command procedure and returns control to the parent command procedure. |
|
Reads a record from a data set. |
|
Declares a symbol parameter shared between nested command procedures. |
|
Branches to a specified location. |
|
Executes different actions according to specified conditions. |
|
Specifies the data set where the screen output data will be stored. For syntax check only. |
|
Opens a data set. |
|
Defines the symbol parameter received from the parent command procedure. |
|
Writes a record in a data set. |
|
Stores the data received from the user through the terminal in the symbol parameter. |
|
Stores the information of the control variable &SYSDVAL in the specified symbol parameter. |
|
Returns control to the command procedure command that is after the command procedure command in which an error is raised. |
|
Stores a value in the symbol parameter or a control variable. |
|
Passes control to the terminal in order to receive user input. For syntax check only. |
|
Displays a string on the terminal. |
Unresolved include directive in modules/tso-guide/pages/chapter-command-procedure.adoc - include::command-procedure/sect-cmd-proc-attn.adoc[]
Unresolved include directive in modules/tso-guide/pages/chapter-command-procedure.adoc - include::command-procedure/sect-cmd-proc-closfile.adoc[]
Unresolved include directive in modules/tso-guide/pages/chapter-command-procedure.adoc - include::command-procedure/sect-cmd-proc-control.adoc[]
Unresolved include directive in modules/tso-guide/pages/chapter-command-procedure.adoc - include::command-procedure/sect-cmd-proc-data-enddata.adoc[]
Unresolved include directive in modules/tso-guide/pages/chapter-command-procedure.adoc - include::command-procedure/sect-cmd-proc-do-end.adoc[]
Unresolved include directive in modules/tso-guide/pages/chapter-command-procedure.adoc - include::command-procedure/sect-cmd-proc-error.adoc[]
Unresolved include directive in modules/tso-guide/pages/chapter-command-procedure.adoc - include::command-procedure/sect-cmd-proc-exit.adoc[]
Unresolved include directive in modules/tso-guide/pages/chapter-command-procedure.adoc - include::command-procedure/sect-cmd-proc-getfile.adoc[]
Unresolved include directive in modules/tso-guide/pages/chapter-command-procedure.adoc - include::command-procedure/sect-cmd-proc-global.adoc[]
Unresolved include directive in modules/tso-guide/pages/chapter-command-procedure.adoc - include::command-procedure/sect-cmd-proc-goto.adoc[]
Unresolved include directive in modules/tso-guide/pages/chapter-command-procedure.adoc - include::command-procedure/sect-cmd-proc-if.adoc[]
Unresolved include directive in modules/tso-guide/pages/chapter-command-procedure.adoc - include::command-procedure/sect-cmd-proc-indata.adoc[]
Unresolved include directive in modules/tso-guide/pages/chapter-command-procedure.adoc - include::command-procedure/sect-cmd-proc-openfile.adoc[]
Unresolved include directive in modules/tso-guide/pages/chapter-command-procedure.adoc - include::command-procedure/sect-cmd-proc-proc.adoc[]
Unresolved include directive in modules/tso-guide/pages/chapter-command-procedure.adoc - include::command-procedure/sect-cmd-proc-putfile.adoc[]
Unresolved include directive in modules/tso-guide/pages/chapter-command-procedure.adoc - include::command-procedure/sect-cmd-proc-read.adoc[]
Unresolved include directive in modules/tso-guide/pages/chapter-command-procedure.adoc - include::command-procedure/sect-cmd-proc-readdval.adoc[]
Unresolved include directive in modules/tso-guide/pages/chapter-command-procedure.adoc - include::command-procedure/sect-cmd-proc-return.adoc[]
Unresolved include directive in modules/tso-guide/pages/chapter-command-procedure.adoc - include::command-procedure/sect-cmd-proc-set.adoc[]
Unresolved include directive in modules/tso-guide/pages/chapter-command-procedure.adoc - include::command-procedure/sect-cmd-proc-termin.adoc[]
Unresolved include directive in modules/tso-guide/pages/chapter-command-procedure.adoc - include::command-procedure/sect-cmd-proc-write.adoc[]