View Only

 Can you copy Ops/MVS variables to other MSF systems in batch?

Jump to Best Answer
Steve Ives's profile image
Steve Ives posted Apr 03, 2024 08:05 AM

The ability to copy variables to other MSF systems via option 4.8 was addded in 2015, I think.

Is there a way to do the same (copy variables) to another system in batch?

I've found the OPMSLS exec in CCLXEXEC and wondered if I could use that directly in batch or create my own EXEC using the same technique, which I think is to just get the value of the variable, do an Address OPSCTL to the remote system(s) and then update the variable. 

I'm trying to create a process that given a groups of EXECs, rules, tables and vairiable, copies them to remote systems.

Steve Ives's profile image
Steve Ives Best Answer

Here we go - mostly taken from OPMSLS:

/* REXX */                                                              
function  = 'COPYN'   /* Or COPYN for a var node list */                
destNodes = 'FDI1 FDI2'                                                 
varName   = 'GLOBALO.NOTIFY.SI_COPY_TEST'                               
do i = 1 to words(destNodes)                                            
   destNode = word(destNodes, i)                                        
/* Copy a variable and subnodes */                                      
   when function = 'COPYN' Then Do                                      
     /*  Get all local vars                    */                       
     rtvl = OPSVALUE(varName,'E')     /* Check is stem has value */     
     if OPSVALUE(varName,'E') = 'N' then varval = ''                    
       varval = OPSVALUE(varName,'O')                                   
     x = opscledq                                                       
     nodeCount = opsvalue(varName,'S')                                  
     do k = 1 to nodeCount                                              
       parse pull subnode.k                                             
       snv.k = opsvalue(subnode.k,'O')                                  
/*  Copy Data to new system                                          */ 
     address OPSCTL "MSF DEFAULT SYSTEM("destNode")"                    
     if varval <> '' Then             /* update if stem has value */    
       RTVL = OPSVALUE(varName,'U',varval)                              
     do j = 1 to nodeCount                                              
       RTVL = OPSVALUE(subnode.j,'U',snv.j)                             
     SC = nodeCount+1 'Variables Copied'                                
     address OPSCTL "MSF DEFAULT SYSTEM(*)"     /* back to local */     
   end  /*when*/                                                        
/*                     GLV COPY VARIABLE                             */ 
   when function = 'COPY' Then do                                       
     varval = OPSVALUE(varName,'O')                                     
     address OPSCTL "MSF DEFAULT SYSTEM("destNode")"                    
     RTVL = OPSVALUE(varName,'U',varval)                                
     address OPSCTL "MSF DEFAULT SYSTEM(*)"     /* back to local */     
     end  /*when*/                                                      
   end /* select */                                                     
end /* do nodes */                                                      

Just needs a few teaks to paramaterise the node, function and destination nodes, maybe add a rename function and then set it up to run in batch.

Marcel van Ek's profile image
Marcel van Ek

Steve, the OPMLS needs ISPF, and  is interactive, so unless you tweak it to provide it with your target remote system(s) I think the short answer is no, not out of the box.

Dave Gorisek's profile image
Dave Gorisek

To simulate the same multi-system options that you see in 4.8 (MC/MD,MO,etc) You would need to have a pgm that does what you ‘thought’ – use Address OPSCTL "MSF DEFAULT SYSTEM("system")" to set/update the variable on the MSF remote system. You would then run that in batch or simply from the TSO foreground. We have a focal OPS utility REXX pgm ‘tool’ that initiates OPS related work like this (update/move vars, display/set parms, create/delete/update/copy tables via logic that uses MSF with SQL statements and invocations to the ASOTEAPI pgm, transfer rules and pgms by running Cyberfusion commands as that’s what we use to move data in our non DASD shared environment, etc) .  Sure it can be done in batch, but the TSO foreground gives you the environment to make the tool more interactive (prompt issuer, spit back info messages to terminal or in scrollable ISPF data set).

John Alexander's profile image
Broadcom Employee John Alexander

Using the POI OPSSETV you can build the callable routine to do this.  It would look like:

/* REXX */                                                      
PARSE ARG varname tgtsys                                        
"OPSSETV" varname "("OPSVALUE(varname,"V")")" "SYSTEM("tgtsys")"

You could call this in batch using POI OPSIMEX and it might look like this:

//COPYVAR  EXEC PGM=OI,                        
Steve Ives's profile image
Steve Ives

Looks like you can't - you have to use OPSVALUE  to read the variable, then use OPSCTL to switch to the remote system and then OPSVALUE again to write the variable.