Review the following examples for a better understanding of OPSVALUE:
Example 1
The following example shows how you can use a serialized update of global variables to implement an enqueue/dequeue strategy that is similar to the RDF table editor:
enqsys = OPSINFO('MSFID'); vrc=0 /* Get our sysid */ enqnew = 'HELD BY' userid 'ON' enqsys /* New value for enqueue */ if sysid <> '' then do /* Remote resource? */ Address 'OPSCTL' "MSF DEFAULT SYSTEM("sysid")" /* Xsys request*/ enqsys = sysid /* Sysid for variable name */ end enqvar = 'GLVTEMP0.ENQ.'enqsys'.'resource /* ENQ variable name */ do i=1 to 100 while vrc=0 /* Try 100 times or works */ enqold = OPSVALUE(enqvar,'V') /* Get current ENQ value */ if enqold = '' | enqold = enqvar then /* If ENQ is free */ vrc = OPSVALUE(enqvar,'C',enqnew,enqold) /* Grab ENQ */ else rc = OPSWAIT(1) /* Wait a little and retry */ end if sysid <> '' then /* Reset Xsys environment */ Address 'OPSCTL' "MSF DEFAULT SYSTEM(*)" if vrc = 0 then /* Test ENQ obtained */ say 'Enqueue of' enqsys'.'resource 'failed. enqold /* Failure */ else deqlist = deqlist enqvar /* Save var name for DEQ */
Example 2
The following example deletes variables that are subnodes of GLOBALA.TEST. if they have not been referenced in one year. The last reference date is word 12 of the variable data record.
xrc = OPSCLEDQ() /* Clear EDQ */ vcnt = OPSVALUE('GLOBALA.TEST.','T') /* Get data on subnodes */ do i=1 to vcnt while QUEUED() > 0 /* Loop thru subnode data */ pull varname /* First record is name */ pull vardata /* Second is data record */ if WORD(vardata,12) = 'NONE' then /* Real old variable */ vardate = 19900101 /* Set to ancient date */ else /* Get data as yyyymmdd */ vardate = SPACE(TRANSLATE(WORD(vardata,12),' ','/'),0) if DATE('B') - DATE('B',vardate,'S') > 365 then /* Not used? */ rcnt = OPSVALUE(varname,'R') /* Delete var + subnodes */ end
Example 3
The following example DROPS (deletes) all variables that are subnodes of GLOBALA.TEST. and sets GLOBALA.TEST. to uninitialized:
val = OPSVALUE('GLOBALA.TEST.','D') /* Delete all subnodes */
Example 4
The following example requests high-level security for the highest level of authority that is allowed. High-level security reduces overhead in applications that perform many global variable operations.
sec = OPSVALUE('GLOBAL.READWRITE','H') /* Request update auth */ if sec <> 'AUTH' then sec = OPSVALUE('GLOBAL.READONLY','H') /* Try read only auth */
The OPSVASRV() function creates and manipulates sysplex variables that are defined in the CA CCS Common Variable Service component (CAVARSRV). These variables are independent from the standard CA OPS/MVS global variables. Currently these sysplex variables are only stored in main storage of the CCS CAVARSRV component.
This CCS CAVARSRV component is active on each system within the sysplex, providing a tool to any CA OPS/MVS automation that stores and manipulates data within the boundaries of a sysplex through this OPSVASRV() function. If one system in the sysplex remains active, the variables that OPSVASRV() creates within any CA OPS/MVS automation on any system continue to exist across system IPLs.
|
Copyright © 2014 CA Technologies.
All rights reserved.
|
|