CA Workload Automation ESP Edition

Expand all | Collapse all

Can I pass a value from a jobdef directly to an alert proc?

Jump to Best Answer
  • 1.  Can I pass a value from a jobdef directly to an alert proc?

    Posted 11-21-2018 02:30 PM

    Hello Forum,

    Given jobdef for job XYZ that triggers alert MPB if overdue:
    JOB XYZ
       MAXRUNTIME=1
       NOTIFY OVERDUE ALERT(MPB) USERS(yada)
       RUN ANY
    ENDJOB

     

    Here is the MPB alert's proc below;
    It passes values like CI QUEUE etc from the
    alert proc intto the SENDMAI4 jcl:

     

    MPB alertproc:

    IF %MNJOB EQ 'XYZ' THEN -
      DO
      CI = 'ca workload automation (jss)'
      QUEUE = 'racf'

      IMPACT = '4'
      TITLE = 'Mainframe Job Overdue %MNJOB'
    ENDDO
    SUBMIT 'A#B.ESPMAINT.CNTL(SENDMAI4)'

     

    But we'd like to be able to set variables like QUEUE, IMPACT etc inside the XYZ jobdef  rather than inside the alert's proc so that the alert itself has something like QUEUE = %yadayada   IMPACT = %impct

    Thus we can use the alert proc for many jobs by amending each of the jobdefs that invoke it as appropriate;

    Is there anyway that I can pass values like
    QUEUE etc from the XYZ jobdef to the MPB alert proc
    rather than  having to hardcode all the
    values in the alert proc?  (sort of like how the alert uses %MNJOB...

     

    eg looking to be able to do something like this:

    JOB XYZ
       MAXRUNTIME=1
       NOTIFY OVERDUE ALERT(MPB) USERS(yada)

       CI = 'ca workload automation (jss)'

       QUEUE = 'racf'

       IMPACT = '4'

      RUN ANY
    ENDJOB

     

    and in the alert's proc be able to glean the values from the invoking jobdef and

    then pass along CI and QUEUE into the sendmai4 jcl

    IF %MNJOB EQ 'XYZ' THEN -
      DO
      CI ='%CI
      QUEUE = %QUEUE

      IMPACT = '4'
      TITLE = 'Mainframe Job Overdue %MNJOB'
    ENDDO
    SUBMIT 'A#B.ESPMAINT.CNTL(SENDMAI4)'

     

    thanks 



  • 2.  Re: Can I pass a value from a jobdef directly to an alert proc?

    Posted 11-22-2018 08:43 AM

    Hi Michael,

     

    Generally there are two possible solutions:

    #1 utilize TAG and jobname/job qualifier in the job definition to store the variable values, and then retrieve them from MNTAG, MNFULLNAME and/or MNQUAL. This doesn't seem work for you, since value 'ca workload automation (jss)' is too long for TAG (limited to 16 chars) and contains blanks so can't be on JOB name or qualifier.

     

    #2 Define global variables and set values by VSET in job definition, then retrieve them by VGET in monitor event. For example, you can define a global variable table for JOB XYZ, it will contains variable CI, QUEUE and IMPACT.  Or you can define one global variable table for all similar jobs, and add job name like XYZ as part of the variable names.

     

    Hope this helps,

     

    Lucy



  • 3.  Re: Can I pass a value from a jobdef directly to an alert proc?

    Posted 11-22-2018 10:02 AM
      |   view attached

    Thanks for the caveat on the MNTAG 16 char limit as that could definitely bite us.   The ‘'ca workload automation (jss)'  is actually a real-life example that all 100 jobs would have to have coded so we could probably just hard-code that particular value as a constant in the alert’s proc.   I’ll just need to see if QUEUE values ever would be > 16 char length or not.  If they all are < 16 char length, then that would allow us to explore both of your recommendations (though we’ve no experience at all in our shop with these TAG-MN* constructs you cite, so maybe an opportunity to try something brand new.  (Can you point us to some doc that would clearly illustrate how one would put these TAG-MN* constructs together??)

     

    Otherwise, we do utilize quite a bit of globals here so we can look at that as well.

     

    thanks for the suggestions Lucy!!  Happy Thanksgiving!



  • 4.  Re: Can I pass a value from a jobdef directly to an alert proc?

    Posted 11-22-2018 10:08 AM

    found some nice TAG examples in the Command Reference.  Just might do the trick Lucy!...thank you!!!



  • 5.  Re: Can I pass a value from a jobdef directly to an alert proc?

    Posted 11-22-2018 10:14 AM

    I think TAG might work for the job defs that only need 1 string passed to the alert proc.   there may be some that require 2 values passed (queuename  and impact value)  so those i fear would have to utilize the global vars paradigm



  • 6.  Re: Can I pass a value from a jobdef directly to an alert proc?

    Posted 11-22-2018 10:23 AM

    Hi Michael,

     

    If the variable values combined are less than 16 chars, then TAG can be used to store multiple variable values.

     

    For example, define following in the job definition:

    TAG 'racf 4' 

     

    Then in the monitor event:

    QUEUE = %MNTAG(4)

    IMPACT = %MNTAG(6:6)

     

    Following is the online doc on variables, scroll to the middle on Use Substring Notation":

    Substitute Using Symbolic Variables - CA Workload Automation ESP Edition - 11.4 - CA Technologies Documentation 

     

    Happy Thanksgiving to you too!

     

    Lucy



  • 7.  Re: Can I pass a value from a jobdef directly to an alert proc?

    Posted 11-22-2018 11:25 AM

    sweet.    what if you have a queue name with a space in it, such as ‘mf support’ and the impact of 4

     

    TAG ‘mf support’ 4            <<<  note I would not want the single quotes passed as part of the queue name…just the value mf support.

     

    would that be legal?

     

    would QUEUE = %MNTAG(10)    resolve to  mf support   or would I need to compensate for the single quotes and make it QUEUE = %MNTAG(2:11)  or something?

     

    IMPACT = %MNTAG(12:12)  ?? if I ignore the single quotes around ‘mf support’    else (14:14)  if I count the single quotes

     

     

    Michael Bieganski

    Technical Analyst

    Exelon C&I Network, Infra & Cloud Ops -Mainframe

     

    Chase Towers

    10 S. Dearborn, 45th Floor

    Chicago, IL 60603

    Office:779 231-7707

    Michael.Bieganski@exeloncorp.com<mailto:Michael.Bieganski@exeloncorp.com>



  • 8.  Re: Can I pass a value from a jobdef directly to an alert proc?
    Best Answer

    Posted 11-22-2018 03:23 PM

    Hi Michael,

     

    The TAG is ONE char string. In your case, you may put the IMPACT value first if it's always one char long, then the rest of the string will be the value for QUEUE.

     

    For example:

    - In job definition:

    TAG '4 mf support' 

     

    Then in the monitor event:

    INTEGER X

    X=LENGTH(MNTAG)

    IMPACT = '%MNTAG(1)' /* first char will be the value for IMPACT*/

    QUEUE='%MNTAG(%X-2:%X)' /*from 3rd char the value is for QUEUE*/

     

    If you need more complex value on TAG, then you may need to use REXX function to retrieve it properly. This means, in monitor event you will need to code REXXON/REXXOFF.

     

    If more help is needed, please open a support case.

     

    Thank you,

     

    Lucy