View previous topic :: View next topic |
Author |
Message |
warp5 Intermediate
Joined: 02 Dec 2002 Posts: 429 Topics: 18 Location: Germany
|
Posted: Wed Sep 14, 2011 8:32 am Post subject: Set variables for a Rexx |
|
|
I have several Rexx routines that need to use the same variables. I want to have a central place for these variables so that they only have to be changed once and are external to the other routines. Maybe somebody has a better solution, but this is how I did it:
The calling Rexx routines use this:
call 'FAHRVARS' /* get fahrplan variables for this system */
do queued()
pull fpvar
interpret fpvar
end
The variables routine looks like this:
/* Rexx Fahrplan Variables - modify! */
queue "fplvw = '49'" /* Country code 49 D, 41 CH, 32 B */
queue "fpsid = 'Z9P1'" /* System ID, compared if sysid = sid */
queue "fpcll = 'CNTL'" /* LLQ for Cntl data sets */
queue "fpdll = 'DOKU'" /* LLQ for Doku data sets (document.) */
queue "fphll = 'HELP'" /* LLQ for Help data sets */
exit
Any better ideas? |
|
Back to top |
|
|
superk Advanced
Joined: 19 Dec 2002 Posts: 684 Topics: 5
|
Posted: Wed Sep 14, 2011 9:18 am Post subject: |
|
|
What sort of environment are you running these exec's in? TSO? ISPF? Batch? MVS? Some other environment (Netview, SA, OPS/MVS, Mainview)?
I'm thinking, if ISPF Services are available, you could use the ISPF VPUT and VGET Services, and store them in the PROFILE pool, to share variables. |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
|
|
Back to top |
|
|
warp5 Intermediate
Joined: 02 Dec 2002 Posts: 429 Topics: 18 Location: Germany
|
Posted: Thu Sep 15, 2011 3:09 am Post subject: |
|
|
Thanks for your answers. Both solutions would work. Kolusu, the solution you suggested is interesting, but I prefer using standard IBM tools if possible. Superk, I did not think of using that possibility, even though I am in an ISPF environment and use VPUT in my routines already. I just did some testing and have decided to stay with the solution I have. The main reason is that it is a clear and easy to use way to do what I need. I feel that the vput solution is a lot more complicated to program seeing as how the number and names of the variables can change. Thanks again for your suggestions. |
|
Back to top |
|
|
asr2 Beginner
Joined: 25 Jun 2011 Posts: 26 Topics: 4 Location: Germany
|
Posted: Fri Sep 23, 2011 4:54 pm Post subject: |
|
|
There is one very easy solution to the problem with changes to the names of global variables used with VPUT, namely, have a global variable that contains the names of the global variable.
For example:
VGET '$VN'
VGET '('$VN')'
Where $VN contains, for example, V1 V2, where V1 V2 are the names of the actual global variables.
I have used this technique in a number of applications, some of which contain hundreds of global variables. The only maintenance involves defining the $VN content; this I do in a central function. |
|
Back to top |
|
|
warp5 Intermediate
Joined: 02 Dec 2002 Posts: 429 Topics: 18 Location: Germany
|
Posted: Mon Sep 26, 2011 1:37 am Post subject: |
|
|
Asr2, thanks for your input. I remember doing that somewhere in one of my routines, but I have written so many that I do not know where that is
Maybe at a later time (when I have more time) I will look into this again, but right now I am content with the solution I am using because it is so clear and easy to read and process. I am distributing the routines to another location where they will have to modify these values, that is why it is important that it is easy to read and change. I will also test the solutions to see how they compare in resources usage. |
|
Back to top |
|
|
asr2 Beginner
Joined: 25 Jun 2011 Posts: 26 Topics: 4 Location: Germany
|
Posted: Mon Sep 26, 2011 5:53 am Post subject: |
|
|
Another, somewhat unusual but easy, way of setting such variables is to use the )SET statement with ISPF file tailoring. With FTINCL, the current variables are fetched and set. This also has the advantage that ISPF file tailoring services, such as variable substitution, can also be used.
Regards
Tony |
|
Back to top |
|
|
|
|