ESP Workload Automation

Expand all | Collapse all

I am trying to pass defined variable between two jobs with the same application.

  • 1.  I am trying to pass defined variable between two jobs with the same application.

    Posted Jan 29, 2018 01:47 PM

    Hi all,

     

    I am really new to cybermation esp and need some expert advice .I am trying to create a schedule  which uses user define variable to  pass information between 2 jobs in the same application. The contain of the variable will then be pass to  JCL by using %INCLUDE to execute step in job. The idea as bellow

     

    APPL TEST

     

    SWITCH1 = ''               
    SWITCH  = ''               
                                 
    JOB JOBA     

      SUBAPPL TEST01   WAIT        
      RUN TODAY                 
      SWITCH1  = 'Y'              
    ENDJOB       

                   

    JOB JOBB                               
      SUBAPPL TEST01   WAIT                     
     IF SWITCH1 = 'Y' THEN DO                  
         SWITCH = 'Y'                           
     ENDDO                                     
      RUN TODAY                                 
      AFTER ADD(JOBA)                      
    ENDJOB                                     

     

    JCL portion where I want to pass the variable


    %INCLUDE   IF(('%SWITCH'  EQ 'Y'))    
    //COPY01   EXEC PGM=IEBGENER          
    //SYSUT1   DD DUMMY                   
    //SYSUT2   DD DSN=ORMA001.TEST.DATA2, 
    //             DISP=(NEW,CATLG,DELETE),
    //         SPACE=(TRK,(1,1),RLSE)     
    //SYSIN DD *                          
    //SYSPRINT DD  SYSOUT=*               
    //SYSOUT   DD  SYSOUT=*               
    //*   
    %ENDINCL                              

     

    The problem I am having is that in JOBB  variable  SWITCH did not get updated to 'Y'  it seam that variable SWITCH1 value of 'Y' that suppose to pass from JOBA  did not occurred. As a result statement in JCL %include did not get executed.

     

    Can someone kindly assist me on this please.

     

    My second question the same topic is there a way for me to display the contain of the variable ?

     

     

    Thank you in advance

     

    MSA



  • 2.  Re: I am trying to pass defined variable between two jobs with the same application.

    Broadcom Employee
    Posted Jan 30, 2018 04:51 PM

    Hi MSA,

     

    This is expected behaviour, as the variable assignment in job  JOBA can't be seen by JOBB.

     

    You may consider use DATA_OBJECT or global variable instead.

     

    For your specific example, you can also move the variable assignment to APPL level:

    IF SELECTED('JOBA') THEN   SWITCH1  = 'Y'  

     

    So it will run when JOBA should run.

     

    Hope this helps,

     

    Lucy



  • 3.  Re: I am trying to pass defined variable between two jobs with the same application.

    Posted Jan 31, 2018 07:44 AM

    Thank you so much for your reply Lucy.

     

    Your propose solution to move the  variable assignment to APPL level seem straight forward for me to implement.  I was wondering will  the SELECTED work if I use DSTRIG function as example bellow. The JOBB is awaiting for dataset before it can run.

     

    I read that the function SELECTED only Checks whether the job name you specify has been selected in this ESP Workload Manager Procedure or another ESP Workload Manager.  Sorry I am really new and   not sure will this work or I need to come up with other method for setting  this up.

     

     

    DSTRIG SCSHI1WG                                          
      DSNAME 'WG.W.XFER.K999999.SCSHI1WG.MEL77700.G-' ANYCLOSE
      SUBAPPL TEST01 WAIT                                  
      RUN WORKDAYS                                           
      RELEASE ADD(JOBB)                            
    ENDJOB    

     

    IF SELECTED('SCSHI1WG') THEN   SWITCH1  = 'Y'            

     

     

    Again Thank you in advance for your time and guidance            

     

     

    MSA                   



  • 4.  Re: I am trying to pass defined variable between two jobs with the same application.

    Broadcom Employee
    Posted Jan 31, 2018 09:58 AM

    Yes, SELECTED will work for DSTRIG wob as well. I tried below and it worked:

    DSTRIG WAIT4.TRIGGER1 
     RUN WORKDAYS
    DSNAME '/u/users/esd/zfs/zhali13/test' USS
    ENDJOB
    IF SELECTED('WAIT4.TRIGGER1') THEN CHECK = '1'

     

    Thank you,

     

    Lucy



  • 5.  Re: I am trying to pass defined variable between two jobs with the same application.

    Posted Jan 31, 2018 10:26 AM

    Thanks for fast reply Lucy. I will try it out



  • 6.  Re: I am trying to pass defined variable between two jobs with the same application.

    Posted Jan 31, 2018 12:37 PM

    Hi Lucy,

     

    Sorry to trouble you again, I tried to implement what you suggested but it seem the value assign to SWITCH1 cant be read in JOBB .

    SWITCH1  is already define in Application level and value  is pass   in application level. JOBB need to read that SWITCH1 = 'Y'

    and assign value  SWITCH ='Y' so that on JCL  can read the input and execute step accordingly.

     

    APPL TEST

     SWITCH1  = ''               
                                 
    JOB JOBA     

      SUBAPPL TEST01   WAIT        
      RUN TODAY                  
     ENDJOB       

     

    DSTRIG SCSHI1WG                                          
      DSNAME 'WG.W.XFER.K999999.SCSHI1WG.MEL77700.G-' ANYCLOSE
      SUBAPPL TEST01 WAIT                                  
      RUN WORKDAYS                                           
      RELEASE ADD(JOBB)                            
    ENDJOB    

     

    IF SELECTED('SCSHI1WG') THEN   SWITCH1  = 'Y'            

     

    JOB JOBB                               
      SUBAPPL TEST01   WAIT                     
     IF SWITCH1 = 'Y' THEN DO                  
         SWITCH = 'Y'                           
     ENDDO                                     
      RUN TODAY                                 
      AFTER ADD(JOBA)                      
    ENDJOB          

     

     

    No matter what I do the JOBB is not seeing the SWITCH1 value 'Y' . I hope there is an easy fix ,  I am really stuck on this 

    Appreciate if you can work your magic and kindly advice me on this        

     

     

     Again Thank you in advance for your time and guidance           



  • 7.  Re: I am trying to pass defined variable between two jobs with the same application.

    Broadcom Employee
    Posted Jan 31, 2018 02:42 PM

    Hi MSA,

     

    I tried here, it worked for me.

     

    Could you simulate with "OUTPUT DATASET ===> * " and show me the output? It will show the JCL with variable value replaced.

     

    Thank you,

     

    Lucy



  • 8.  Re: I am trying to pass defined variable between two jobs with the same application.

    Posted Feb 02, 2018 02:24 PM

    Hi Lucy,

     

    I don't see anything much when I simulate. So I added Send command in the coding to display at my console

     

    APPL TEST                                                        

    SWITCH1 =''                                                          
                                                                           
    JOB JOBA                                                           
      SUBAPPL TEST01   WAIT                                                
      RUN TODAY                                                            
    ENDJOB                                                                
                                                                           
    DSTRIG DATA1                                                           
      DSNAME 'ORMA001.TEST.DATA' ANYCLOSE                                  
      SUBAPPL TEST01 WAIT                                                  
      RUN WORKDAYS                                                         
      RELEASE ADD(JOBB)                                               
    ENDJOB                                                                 
                                                                           
    IF SELECTED('DATA1') THEN DO                                           
      SEND ' BEFORE VALUE IN DATA1 SWITCH1 = %SWITCH1' USER(ORMA001)       
         SWITCH1 = 'Y'                                                     
      SEND ' AFTER  VALUE IN DATA1 SWITCH1 = %SWITCH1' USER(ORMA001)       
    ENDDO                                                                  
                                                                           
    JOB JOBB                                                            
      SUBAPPL TEST01   WAIT                                                
     SEND 'JOB2 VALUE BEFORE SWITCH1 = %SWITCH1' USER(ORMA001)           
     IF (%SWITCH1 = 'Y') THEN DO                                           
         SWITCH = 'Y'                                                      
         SEND 'JOB2 VALUE AFTER SWITCH1 = %SWITCH1' USER(ORMA001)          
         SEND 'JOB2 VALUE AFTER SWITCH = %SWITCH' USER(ORMA001)            
     ENDDO                                                                
     RUN TODAY                                                             
       AFTER ADD(JOBA)                                                 
     ENDJOB                                                                

    The result of my display

    in IF SELECTED('DATA1') THEN DO .. it displayed as bellow  . I can see the SWITCH1  was null then value Y assigned correctly

    BEFORE VALUE IN DATA1 SWITCH1 =  ESP(ORMA001) 

    AFTER  VALUE IN DATA1 SWITCH1 = Y ESP(ORMA001)

     

    In JOBB it displayed as bellow

     

    JOB2 VALUE BEFORE SWITCH1 =  ESP(ORMA001)

     

    It seem that  at JOBB the SWITCH1  value is  null.  As a result it didn't get into the IF statement in JOBB.

    I am puzzled SWITCH1 is application level variable and value assign in application level.

     

    Can you kindly advice. 

     

    Thank you so much for your patient on helping me .

     

    MSA



  • 9.  Re: I am trying to pass defined variable between two jobs with the same application.

    Broadcom Employee
    Posted Feb 05, 2018 02:06 PM

    Hi MSA,

     

    Sorry for my misleading.

     

    I just got the time to test it out, and got same result as yours. The reason is that SELECTED function gives proper result only at application generation phase. 

     

    So you can use another function TODAY('criteria') while criteria is the same as what's on the RUN statement for the DSTRIG WOB, like:

    APPL TEST                                                        

    SWITCH1 =''                                                          
                                                                           
    JOB JOBA                                                           
      SUBAPPL TEST01   WAIT                                                
      RUN TODAY                                                            
    ENDJOB                                                                
                                                                           
    DSTRIG DATA1                                                           
      DSNAME 'ORMA001.TEST.DATA' ANYCLOSE                                  
      SUBAPPL TEST01 WAIT                                                  
      RUN WORKDAYS                                                         
      RELEASE ADD(JOBB)                                               
    ENDJOB                                                                 
                                                                           
    IF TODAY('WORKDAY') THEN DO       /*the criteria is the same as RUN for DSTRIG DATA1 */                                     
      SEND ' BEFORE VALUE IN DATA1 SWITCH1 = %SWITCH1' USER(ORMA001)       
         SWITCH1 = 'Y'                                                     
      SEND ' AFTER  VALUE IN DATA1 SWITCH1 = %SWITCH1' USER(ORMA001)       
    ENDDO                                                                  
                                                                           
    JOB JOBB                                                            
      SUBAPPL TEST01   WAIT                                                
     SEND 'JOB2 VALUE BEFORE SWITCH1 = %SWITCH1' USER(ORMA001)           
     IF (%SWITCH1 = 'Y') THEN DO                                           
         SWITCH = 'Y'                                                      
         SEND 'JOB2 VALUE AFTER SWITCH1 = %SWITCH1' USER(ORMA001)          
         SEND 'JOB2 VALUE AFTER SWITCH = %SWITCH' USER(ORMA001)            
     ENDDO                                                                
     RUN TODAY                                                             
       AFTER ADD(JOBA)                                                 
     ENDJOB         

     

    Please see if it works for you,

     

    Lucy               



  • 10.  Re: I am trying to pass defined variable between two jobs with the same application.

    Posted Feb 05, 2018 10:41 PM

    Thanks Lucy will try this out



  • 11.  Re: I am trying to pass defined variable between two jobs with the same application.

    Posted Feb 06, 2018 06:08 AM

    I ran the suggested solution its works!! . Thanks.

     

    Just wondering if there is more then 1 DSTRIG DATA1 as bellow  how does cybermation "TODAY"  function know to  distinguish run of  DSTRIG DATA1  or DSTRIG DATA2. 

     

     

    DSTRIG DATA1                                                           
      DSNAME 'ORMA001.TEST.DATA' ANYCLOSE                                  
      SUBAPPL TEST01 WAIT                                                  
      RUN WORKDAYS                                                         
      RELEASE ADD(JOBB)                                               
    ENDJOB                    

     

     

    DSTRIG DATA2                                                            
      DSNAME 'ORMA002.TEST.DATA' ANYCLOSE                                  
      SUBAPPL TEST01 WAIT                                                  
      RUN WORKDAYS                                                         
      RELEASE ADD(JOBB)                                               
    ENDJOB                                                                                                               



  • 12.  Re: I am trying to pass defined variable between two jobs with the same application.

    Broadcom Employee
    Posted Feb 06, 2018 08:52 AM

    Hi MSA,

     

    Glad to know it worked.

     

    No, TODAY function can't tell, and I don't see this matters. 

     

    This solution is not a very general one, if the conditions change, it needs to adjust or not function any more.

     

    Following is the online doc link for "Examples Cookbook" where you can find many useful examples for different scenarios:

    Examples Cookbook - CA Workload Automation ESP Edition - 11.4 - CA Technologies Documentation 

     

    Welcome to ESP world! You may find it not easy to use at first and I am sure you will like it as it's a very powerful and flexible tool.

     

    Lucy



  • 13.  Re: I am trying to pass defined variable between two jobs with the same application.

    Posted Feb 06, 2018 10:41 PM

    Thanks Lucy for your help. I have learn a lot in my journey to develop my first ESP application.