z/OS Freeware

How to use the REXX Compiler with ISPF

God Bless America

Site Navigation

Home
ABCs of OS/390 and z/OS
My Articles
Beta Page
Documentation
ISPF Tools
OMVS Tools
Other Interesting Sites
I.T. Sites
TCP/IP Tools
We Owe Them
Useful Tools
Thoughts on Management
Personal Spiritual Favorites

Comments

Monitor this page for changes


it's private by ChangeDetection


  CBT Tape

Web Site Hosting

The REXX Compiler presents some additional challenges when attempting to use ISPF services. These challenges include the discovery that a REXX application that used to work as a TSO command works only until it references an ISPF variable at which point it fails miserably.

Note that when compiling the REXX application that you should specify Compiler Options of OBJ(,CPPLEFPL,loadlib.dsname). I have found this works the best for my purposes.

There are four solutions to this problem:

Solution 1 is to re-educate all of your users that they no longer invoke the application by entering TSO cmd but rather they must somehow invoke it using the SELECT CMD(xxxx) LANG(CREX). That is fine if you want to have the user re-educated or if you want to provide another REXX application that just issues this command.

Solution 2 is to reference the variable in the REXX application as ISPF variables and not as REXX variables. This means that you can't create a variable in an ISPF service and then use it in the REXX application. This is demonstrated by the following example:

"LMInit dataid(vardata) ddname(spftemp1)"
"Browse dataid(&vardata)"

In this case the LMInit service defines a variable called vardata. Normally the Browse dataid would be coded "Browse dataid("vardata")" but in this case it is coded not as a REXX variable but with an & and let ISPF resolve it as an ISPF variable. (This thanks to a tip from Doug Nadel)

Solution 3 is the most extensive and perhaps the simpliest for the end user. It involves inserting code into the front of the REXX application. To do this insert somewhere near the front of the application the following code:

arg options

if wordpos("xyzCREXxyz",options) = 0
then do
     cmd = sysvar("syspcmd")
     Address ISPExec "Select Cmd("cmd options "xyzCREXxyz) Lang(CREX)"
     Exit 0
     End
else do
     wp = wordpos("xyzCREXxyz",options)
     options = delword(options,wp,1)
     end 

What this will do is to:

1. Extract from the command line the input options provided by the user (if any)

2. Test for a unique character string, in this case xyzCREXxyz

3. If the string is not found then get the command name (syspcmd) and recursively invoke it adding our character string to the command options

4. When the command ends execution resumes with the command after the Address statement which exits the application

5. When the character string is found it is removed from the options variable.

Solution 4 requires more coding but it will make your exec bi-modal in that your code will work in both interpretive and in compiled form:

/* rexx */
arg options
icmd = sysvar("sysicmd")
parse source . . prog .
if icmd <> prog then do
if wordpos("123XYZ321",options) = 0 then do
   cmd = sysvar("syspcmd")
   say "Executing compiled code"
   Address ISPExec "Select cmd("cmd options" 123XYZ321) Lang(CREX)"
   Exit 0
   end 
else do
     wp = wordpos("123XYZ321",options)
     options = delword(options,wp,1)
     end
end
/* execute the desired code here */
say "sysicmd:" sysvar("sysicmd")
say "syspcmd:" sysvar("syspcmd")
say "prog:" prog

What this will do is to:

1. Extract from the command line the input options provided by the user (if any)

2. Get the name of the interpretive command (sysicmd) and then via parse get the name of the command (prog)

3. Test to see if icmd is different from prog which would be the case for compiled code

4. Test for a unique character string, in this case 123XYZ321

5. If the string is not found then get the command name (syspcmd) and recursively invoke it adding the character string to the command options

6. When the command ends execution resumes with the command after the Address statement which exits the application

7. When the character string is found it is removed from the options variable.

 

 

This site is a member of WebRing.
To browse visit Here.