Adrian_Weber_565

Trying to restart a process flow based off of a variable within a script.

Discussion created by Adrian_Weber_565 on Mar 30, 2015
Latest reply on Mar 31, 2015 by Adrian_Weber_565
Hi everyone,
I've created a process flow that monitors our OVERNIGHT_BATCH process in our test environment.  At 7AM, the process runs and produces an e-mail (via NOTIFICATION OBJECTS) as to whether or not the process has completed or is still running.  This is determined by an IF/ELSE statement, as seen below:
         : IF &VK# = &JOBNAME#
         :   SET &JOB_RUNNING# = 1
         : ELSE
         :   SET &JOB_RUNNING# = 0
         : ENDIF

and then, later in the script, it is used to:
          : IF &JOB_RUNNING# <> 1
          :  set &email_status# = ACTIVATE_UC_OBJECT(LINUX.SCHEDULE.DELAY.NOTIFICATION.TEST.ENV,,,,,,,,)
          :    ELSE
          :    set &email_status# = ACTIVATE_UC_OBJECT(LINUX.SCHEDULE.ON.TIME.NOTIFICATION.TEST.ENV,,,,,PASS_VALUES)
          : ENDIF

What I would like to do, however, is add another step in the IF/ELSE statement that says
         : IF &JOB_RUNNING# <> 1
         :  set &email_status# = ACTIVATE_UC_OBJECT(LINUX.SCHEDULE.DELAY.NOTIFICATION.TEST.ENV,,,,,,,,)
         :    WAIT 3600
         :  set &retry# = ACTIVATE_UC_OBJECT (PARENT.PROCESS.FLOW.NAME)
         :    ELSE
         :    set &email_status# = ACTIVATE_UC_OBJECT(LINUX.SCHEDULE.ON.TIME.NOTIFICATION.TEST.ENV,,,,,PASS_VALUES)
         : ENDIF

which basically would have this process restart every hour, ONLY if &JOB_RUNNING# <> 1.  If &JOB_RUNNING# = 1, then perform the ELSE statement and continue on.

Unfortunately, when I do the above, I get an error message stating:  U0020423 Runtime error in object '***', line '00030': object must not activate itself (endless loop).

The thing is, I actually WANT the looping behavior, until the variable reads &JOB_RUNNING# = 1.
Does anyone have any idea how to get around this?  I thought maybe I could use a "user defined" POSTCONDITION on the script within the process flow, but the POSTCONDITION won't recognize the &JOB_RUNNING# variable, even if I use a PSET on &JOB_RUNNING#.
I considered adding another job in the process flow to catch the variable, but even if that worked, I believe that I'd still get the "object must not activate itself" issue, just on the next job.

Any thoughts would be most welcome.

Thank you!

Outcomes