Previous Topic: Return Codes

Next Topic: OPSGETV Command Processor—Retrieve Global Variable Value

OPSEXEC Command Processor—Run a Specified Program

The OPSEXEC (OX) command processor causes an explicitly specified program to run. The function of OPSEXEC is similar to that of OPSIMEX, except that OPSEXEC requires that the full command path be supplied. OPSEXEC can execute a command that is outside the command concatenation.

This command has the following format:

OPSEXEC|OX
{PROGRAM('dsname')|PROGRAM('dsname(member)')}
[ARG('arguments')]
[ITRACE(x)]
[MAXEDQ(lines)]
[SUBSYS(ssid)]
[WORKSPACE(size)]

To execute an OPS/REXX source program directly from TSO READY mode (or ISPF PDF menu 6) using the OPS/REXX interpreter, use either of the following formats for OPSEXEC:

OPSEXEC "dsname" argument
OX "dsname" argument
OPSEXEC Keywords and Arguments

You can abbreviate the PROGRAM, ARG, and SUBSYS keywords as P, A, and S respectively.

PROGRAM

This argument defines the data set (or optionally, member) of the OPS/REXX source program to execute.

The PROGRAM name can be provided as a fully qualified data set name, enclosed in single quotes, and can represent either a sequential data set or a PDS. If you specify a PDS, then it is necessary to also specify a member.

You can also specify a member of a precompiled REXX data set. The record formats supported for the SYSEXEC libraries are the same as those supported for REXX data sets used to invoke OPS/REXX explicitly.

The program name can be provided as an unquoted data set name or an unquoted data set name and member name. If you do not use quotes, then the OPSEXEC command processor creates a data set name that consists of your default TSO prefix, then any data set name you specified, and finally REXX.

Examples: PROGRAM arguments

  1. Specify a fully qualified data set name to execute a REXX EXEC stored in a sequential data set:
    ADDRESS TSO "OPSEXEC PROGRAM('TSOPFX.OPS.PROGRAM1')"
    
  2. Specify a fully qualified data set name and member to execute a REXX EXEC stored in a member of a PDS:
    ADDRESS TSO "OPSEXEC PROGRAM('OPSPFX.OPS.REXX(TESTPROG)')"
    
  3. Specify an unquoted data set:
    ADDRESS TSO "OPSEXEC PROGRAM(O)"
    

OPSEXEC expands the above to HLQ.O.REXX, which is presumed to be a sequential data set. HLQ represents your default TSO prefix. Similarly, OPSEXEC would expand PROGRAM(O(member)) to HLQ.O.REXX(member), and PROGRAM((member)) expands to HLQ.REXX(member).

ARG

(Optional) Specifies any characters to be passed to the program. Leading blanks are stripped from the argument. Enclose the argument in quotes only if you want to pass those quotes to the program. The 'arguments' string cannot exceed 256 characters in length. The following are three examples of arguments:

The following command invokes program 'userprefix.MYLIB.REXX(ABC)' with a null argument:

OX MYLIB(ABC)

The following command invokes program 'SYS1.REXX(ABC)' with an argument of Now is the time:

OX "SYS1.REXX(ABC)" Now is the time

The following command invokes the program 'userprefix.REXX(ABC)' with the argument string 'SYS1.LINKLIB'. Note that the quotes are part of the argument passed to the program.

OX (ABC) "SYS1.LINKLIB"

Note: If the argument string includes a quotation mark, OPS/REXX must be able to tell the difference between a quote that is part of a string and the quotes that delimit the string.

To signify that a quote is part of a string, you can use a pair of quotation marks to represent it as shown in the following example:

OI PROGRAM(TEST) ARG('There is a single quote ''in this arg string')
OI PROGRAM(TEST) ARG("There is a double quote ""in this arg string")

However, a better way to distinguish a quote in a string from the string delimiters is to make the delimiters a different type of quote from that used in the string-that is, if the string contains a double quote, use single quotes as string delimiters and, conversely, if the string contains a single quote, use double quotes as string delimiters. The following example demonstrates how to do this:

OI PROGRAM(TEST) ARG("There is a single quote 'in this arg string")
OI PROGRAM(TEST) ARG('There is a double quote "in this arg string')

If the argument string includes any unbalanced parentheses, OPS/REXX must be able to tell the difference between an unbalanced parenthesis that is part of a string and a command syntax error. To signify that an unbalanced parentheses is part of a string, you must enclose the string in quotation marks as shown in the following example:

OI PROGRAM(TEST) ARG('There is an unbalanced (parentheses in this arg string')
OI PROGRAM(TEST) ARG("There is an unbalanced) parentheses in this arg string")

Argument strings that contain balanced parentheses do not have to be enclosed in quotation marks. In fact, CA OPS/MVS does not even require that you use the keyword format of the command in such cases, as shown in the following example:

OI PROGRAM(TEST) ARG(There is a balanced () parentheses in this arg string)
OI TEST There is a balanced ( parentheses ) in this arg string
ITRACE

(Optional) Sets an initial TRACE value for program execution.

The ITRACE keyword enables you to do debugging without having to add a TRACE statement to your OPS/REXX program.

This is especially useful for debugging precompiled OPS/REXX programs. You do not have to go back and edit the source version to add the TRACE statement to perform debugging. You can specify any of these values in place of x:

Note: Any TRACE statement that is in the OPS/REXX program overrides the value you specify for the ITRACE keyword.

MAXEDQ

(Optional) Overrides the value (for this execution only) of the REXXMAXQUEUE parameter. The REXXMAXQUEUE parameter sets the maximum number of output lines that an OPS/REXX program or request rule can have in its external data queue. For more information about the REXXMAXQUEUE parameter, see the Parameter Reference.

SUBSYS

For more information on the SUBSYS keyword, see Specifying a Subsystem ID on a POI Command Processor in this chapter.

WORKSPACE

(Optional) Defines the size of the REXX program workspace. It is specified in bytes. The default size is 1.5 megabytes. The minimum value is 40960, which only works for OPS/REXX programs that use few variables. For example, if a program creates a large number of stem variables (compound symbols) and you want a three-megabyte area, you would specify WORKSPACE(3145728).

Workspace size limits the maximum number of nested calls, symbols, and values that can be used during program execution. If your programs have large memory requirements, use the size value to specify a workspace that is larger than the default.