On Wed, 12 Oct 2016 07:31:16 -0500, John McKown <[email protected]> wrote:
> What I'm trying to do is emulate the use of "global" CA-OPS/MVS variables.
> I.e. variables which can
>be created in any rule and read / modified / deleted in any other rule.
John,
I emulated the services of Netview global variables (albeit inelegantly) by
using a rexx function that created a traditional MVS dataset for each global
variable.
Depending on your number of variables and update frequency, this may or may not
be the best solution but it works in our environment.
GLOBALV:
/* REXX - GLOBALV - Process Global Variable */
/* */
/* Usage: GLOBALV(verb,name,contents) */
/* Where verb is: SET or S - Set variable */
/* QUERY or Q - Query variable */
/* DELETE or D - Delete varable */
/* */
/* name is varable name */
/* value is what to set the varable to */
/* */
Parse arg verb, name, value
If wordpos(verb,'QUERY Q SET S DELETE D') < 1 Then Return -1
/* x=msg(off) */ /* turn off messages */
"FREE FI(GLOBDD)" /* Free the DD */
dsn = "'SYS3.GLOBAL."name"'" /* Set global file name*/
Select
When left(verb,1) = 'S' Then Do
"ALLOC FILE(GLOBDD) DA("dsn") SHR" /* Try allocating it */
If rc > 0 Then Do /* Allocation failed */
/* so need to */
"ALLOC FILE(GLOBDD) DA("dsn")", /* Allocate a new one */
"SPACE(1,1) TRACKS",
"DSORG(PS) NEW CATALOG",
"RECFM(V B) LRECL(32760)"
End
LINE.1 = value /* Set it to passed value */
"EXECIO 0 DISKW GLOBDD (OPEN" /* and write it out */
"EXECIO * DISKW GLOBDD (STEM LINE."
"EXECIO 0 DISKW GLOBDD (FINIS" /* and close it */
"FREE FI(GLOBDD)" /* Free the DD */
Return 'OK'
end
When left(verb,1) = 'D' Then Do
"DELETE" dsn /* Delete it */
Return 'OK'
end
When left(verb,1) = 'Q' then Do
"ALLOC FILE(GLOBDD) DA("dsn") SHR" /* Try allocating it */
If rc > 0 Then Do /* Allocation failed */
Return '' /* return null */
End
INREC. = ''
"EXECIO * DISKR GLOBDD (STEM INREC. FINI" /* Read in contents */
"FREE FI(GLOBDD)" /* Free the DD */
Parse var INREC.1 value /* set variable */
Return value
end
Otherwise
Return -1
end
Return
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN
