Previous Topic: Execute OPS/REXX Programs from Batch (Under the Batch TSO TMP)Next Topic: The Interaction of OPS/REXX with Other Languages


Execute OPS/REXX Programs from USS

OPS/REXX programs can be executed in the USS shell by invoking the OI or OX command from an HFS or zFS in compatibility mode file. The only restriction is that TSO must not be active in the same address space in which OPS/REXX is invoked. For an OMVS session invoked from TSO or ISPF, the parameter NOSHAREAS must be specified with the OMVS command. This ensures that the USS shell actually runs in a USS transaction server address space. Command syntax parsing in USS is also different than in TSO. USS parses the parameter string that follows the command file name for imbedded variable substitution and other USS commands. Therefore the parameters destined for OPS/REXX must be enclosed in single or double quotes. Double quotes are not as restrictive as single quotes and may result in the need to use the escape character to prevent undesired substitutions.

While OX dynamically allocates the data set containing the desired OPS/REXX program, OI assumes a pre-allocated SYSEXEC data set. SYSEXEC must be allocated in the USS transaction server address space for OI to work. Although OPSDYNAM is an OPS/REXX host command, it can also be used as a USS shell command to allocate the required SYSEXEC data sets. Other POI commands that can execute as USS shell commands are OPSGETV, OPSGETVL, OPSSETV, OPSDELV, and OPSQL. All other OPS/REXX functions and host commands such as ADDRESS WTO are available in an OPS/REXX program run as a USS command using OI or OX.

There are two ways to place CA OPS/MVS commands in the USS HFS or zFS in compatibility mode file system. The first method is to copy the desired commands with all their aliases to a PDSE data set, and then use the TSO OPUT command to copy the PDSE load modules to the desired HFS or zFS in compatibility mode directory. In the case of OPS/REXX, you would use ISPF 3.3 to copy module OPSIMEX and all its aliases (OI, OICOMP, OIDB, OPSEXEC, OX, OXCOMP, OXDB, and OXSCAN) to a PDSE. Then issue the OPUT command from TSO for any aliases you want to place in the HFS or zFS in compatibility mode:

OPUT 'OPS.PDSELOAD(OX)'  '/opsmvs/ox'  BINARY
OPUT 'OPS.PDSELOAD(OI)'  '/opsmvs/oi'  BINARY

The disadvantage of this method is that maintenance applied to the product must be propagated manually to the HFS or zFS in compatibility mode.

The second method is to create null HFS or zFS in compatibility mode files for the commands and use the sticky bit feature of HFS or zFS in compatibility mode files to cause USS to search for the real load modules from STEPLIB and LINKLIST/LPA. To create the null files, issue the following USS command:

touch  /opsmvs/oi

To set the sticky bit for the file, issue the USS command:

chmod o=+s  /opsmvs/oi

To verify the permissions of the command files, issue the USS command:

ls -EH /opsmvs/oi

The advantage of this method is that no special procedures are required to recopy module maintenance, no PDSE is required for copies, and no significant HFS or zFS in compatibility mode file space is used. However, when the sticky bit method is used, dynamic allocations using OPSDYNAM as a command to allocate SYSEXEC is not retained for subsequent commands. In this case the OI command is of no practical use and only OX can be used.

To execute the OPS/REXX commands in the HFS or zFS in compatibility mode from a Telnet or OMVS NOSHAREAS session, the CA OPS/MVS load library must be in the system LINKLIST/LPA or a STEPLIB must be used. For example, you could use the following sequence of USS shell commands to execute the MYEXEC OPS/REXX program:

export STEPLIB=SYS1.OPS.CCLXLOAD
/opsmvs/ox  "'SYS2.OPS.REXX(MYEXEC)'"

Following is an example of how to call OPSQL directly:

/opsmvs/opsql "SELECT RULENAME FROM AOF_PERIODS WHERE NODE='XE33'"

To use OPS/REXX in the IBM USS REXX, OI and OPSDYNAM can be called as functions if they are located in the LINKLIST/LPA or STEPLIB. The argument list consists of a single argument using the same syntax as the TSO command. The following USS REXX program invokes OI to execute an OPS/REXX program:

  /*    Rexx    */
  /*  Invoke OPS/REXX program  TESTINFO */
  opsrc = OPSDYNAM("ALLOC DD(SYSEXEC) DSN(SYS2.O.REXX) SHR REUSE")
   say "Calling OPS/REXX"
  opsrc = OI("TESTINFO")
  do while QUEUED() > 0
    pull qmsg
    say "XDQ="qmsg
  end 
  return opsrc

The following USS REXX program invokes OPSQL as a function:

  /*    Rexx    */
  z = OPSQL("SELECT RULENAME FROM AOF_PERIODS WHERE NODE='XE33'")
   say 'RC'z
  if RULENAME.0>0 then
  do I=1 to RULENAME.0
    say RULENAME.i
  end