Ouch, all those nice REXX exec's you've created suddenly stop running (unless you decided to ask for a userid that is the same as the one you use for your everyday job, something I'd advise against), so what do you do?
One obvious way to reduce site-dependency is to use the 'userid()' builtin function, or the 'ZPREFIX' variable, but there are things that you cannot catch this way, like the names of system datasets like the ones hanging off the DDNAMEs in your logon procedure, e.g. SYSFAN.REXX or the fact that JOBNAMEs and/or the (MSG)CLASSes are different.
To catch such issues, you can create an exec that takes a parameter, and returns the correct value for system dependent variables. Very basic, it might look like this:
- Code: Select all
/* REXX exec to return common values to calling execs */
/*** trace ?r ***************************************************** \| *
* GETVAR is a REXX exec to return a number of commonly used values to *
* the calling exec. *
* *
* The objective of this exec is to make it possible to change the *
* commonly used values at one single location, instead of having to *
* change the values in every exec that uses them. *
***********************************************************************/
parse source source
parse value source with . . moi .
/***********************************************************************
* Check if ISPF is active *
***********************************************************************/
"ispqry"
!ispf = (rc = 0)
if rc = 0 then
do
"ispexec control errors return"
"ispexec vget (zenvir)"
end
else
zenvir = ''
env = strip(substr(zenvir, 17, 8))
parse arg !what
signal fandezhi /* 5 */
signal xxxx /* 3 */
/***********************************************************************
* FANDEZHI: *
* *
* This procedure contains all site-specific data for FanDeZhi *
***********************************************************************/
fandezhi:
if !ispf then
!here = 'FanDeZhi'
else
!here = 5
!qual = 'prino.'
!live = 'rahp.'
!rahp = 'prino'
select
when !what = 'EXEC' then return !rahp'.rahp.exec'
when !what = 'LOAD' then return !qual || !live || 'load'
when !what = 'HERE' then return !here
when !what = 'JCM' then return '//PRINOJOB JOB (PRINO),|M|X|'
otherwise return '?'
end
exit
/***********************************************************************
* XXXX: *
* *
* This procedure contains all site-specific data for XXXX *
***********************************************************************/
xxxx:
if !ispf then
!here = 'XXXX'
else
!here = 4
!qual = 'xxxxxx.'
!live = 'rahp.'
!rahp = 'xxxxxx'
select
when !what = 'EXEC' then return !rahp'.rahp.exec'
when !what = 'LOAD' then return !qual || !live || 'load'
when !what = 'HERE' then return !here
when !what = 'JCM' then return '//xxxxxxCL JOB (xxxxxx),|T|X|'
otherwise return '?'
end
exit
Using this, you can e.g. call your execs by using "exec '"getvar('EXEC')"(whatever)'", and when moving to a new site, the only exec you have to change is "getvar" (or whatever you decide to call it) by adding a new section and an extra "signal" statement. I've been doing this for years and it makes life a lot easier.