Previous Topic: Keyword Argument

Next Topic: OPSVALUE Function

Example: OPSUSS

The following example uses OPSUSS to get the pid of caiopr (CA Event Manager).

procpid=0
procstat='DOWN'
if OPSINFO('OMVS') == 'READY' then do 
  pid=OPSINFO('USSPID') 
  /*  If not dubbed yet, change to superuser mode                  */
  if pid = 'N/A' then
    uid=OPSUSS('SET','EUID',0)
  /*  Find caiopr processes                              */
  status=OPSUSS('PROCESS','PATH','*/tngfw/opr/bin/caiopr')  
  select 
    when status = 1 then
      do
        procstat='UP'
        procpid=ussda_pid.1
      end
    /* Handle multiple occurrences of the same path but with one    */
    /* parent pid (caiopr)                                         */
    when status > 1 then
      do 
        pgid=ussda_pgpid.1
        do ix = 2 to status
          if ussda_pgpid.ix <> pgid then
            leave                        
        end
        if ix > status then
          do
            procpid=pgid
            procstat='UP'
          end
      end 
    otherwise 
      nop
  end
end