What are OPS/REXX best practices?
Component: OPS/MVS
The OPS/REXX Interpreter
The OPS/REXX interpreter provided by OPS/MVS runs many times faster than the TSO EXEC command for similar programs. Also, when you use OPS/REXX in the AOF environment, all the code is pre-interpreted to speed up processing even further. OPS/REXX generally runs so speedily that most users do not need to rewrite functions in assembler language. OPS/REXX provides automation from the point where it intercepts messages and commands from JES and z/OS.
Uses of OPS/REXX in the OPS/MVS Product
The following components use OPS/REXX:
Similarities Between OPS/REXX and Standard REXX
Both OPS/REXX and the standard REXX language enable you to issue commands to various host environments. Both versions of REXX offer symbolic substitution that is simpler than in the TSO/E CLIST language or in z/OS JCL. The current version of OPS/REXX supports these standard REXX features:
Characteristics of OPS/REXX Programs
Use the OPSEXEC and OPSIMEX commands to execute OPS/REXX programs in source code or precompiled format. Use the OXCOMP and OICOMP commands to compile OPS/REXX programs without executing them. When used with the AOF, OPS/REXX programs have a special structure and are called rules. Outside the AOF environment, OPS/REXX programs are called programs.
Unless you have precompiled rules, the OPSMVS product compiles rules when you activate them with the ENABLE command and runs them strictly from their internal form (rather than reloading and reinterpreting them each time they are needed). Outside the AOF environment, OPS/REXX programs execute from source code or from staged internal forms.
Differences Between Precompiled and Source REXX Programs
The OPS/MVS product has always supported running OPS/REXX programs in source code format. Now, the product also supports storing and running precompiled OPS/REXX programs. You can issue OXCOMP and OICOMP commands to compile OPS/REXX programs without executing them; both commands store the compiled REXX code in the data set allocated to the OPSCOMP ddname. You can copy data sets containing precompiled
OPS/REXX programs with no restrictions. Precompiled OPS/REXX programs use exactly the same REXX functions as source code
programs, but the precompiled programs are loaded faster. When you call a precompiled program, OPS/REXX loads and executes it, eliminating the time needed to read the source code and compile it. In contrast, source code programs take more time to load because OPS/REXX has to read and compile the code first. Differences Between Explicit and Implicit Program Execution The only difference between implicit and explicit program execution is how you specify the name of the program to execute and where OPS/REXX looks for the name:
How OPS/REXX Locates Stored OPS/REXX Programs
OPS/REXX programs can reside in OPSEXEC data set libraries or in data sets elsewhere in the SYSEXEC concatenation. Programs in data sets allocated to
OPSEXEC execute faster because OPS/REXX can execute them without compiling them first. When you invoke a program, OPS/REXX always looks for it first in the OPSEXEC libraries. This is true as long as you have allocated the OPSEXEC ddname. If the program is not there, OPS/REXX looks in the SYSEXEC libraries and, after finding it, reads, compiles, and runs it. Note: To avoid slowing down OPS/MVS processing, use the OPSEXEC DD, which prevents REXX code from being compiled at runtime.
Executing a Program that Calls External Routines
Compiling an OPS/REXX program also compiles all subroutines associated with it. The way OPS/MVS scans for external routines depends upon whether you are editing a sequential data set or the member of a partitioned data set. When you explicitly execute an OPS/REXX program that is not precompiled and that
resides in a partitioned data set, OPSMVS scans that data set to try to locate any external routines. If external routines are not found in the data set
containing this program, OPS/MVS then searches in the libraries concatenated under the SYSEXEC ddname.
When you explicitly execute a program residing in a sequential data set, OPSMVS scans only the SYSEXEC ddname for external routines. When you use either the !OI or !OX edit macro, you are explicitly executing a program. GREXX is the REXX used by OPSMVS when you us the OI or OX command processors.