Examples of using loop stages

You can use loop stages to build loops into your job sequences.

The following is a section of a job sequence that makes repeated attempts to run a job until either it succeeds, or until the loop limit is reached. The job depends on network link that is not always available.

Figure 1. Example of using a loop in a sequence

Shows the example job sequence using loop activity stages

The Start Loop stage, networkloop, has Numeric loop selected and the properties are set as follows:

Figure 2. Numeric loop properties

Shows the settings for the numeric loop in the example job

This defines that the loop will be run through up to 1440 times. The action differs according to whether the job succeeds or fails:

  • If it fails, the routine waitabit is called. This implements a 60 second wait time. If the job continually fails, the loop repeats 1440 times, giving a total of 24 hours of retries. After the 1440th attempt, the End Loop stages passes control onto the next activity in the sequence.
  • If it succeeds, control is passed to the notification stage, emailsuccess, and the loop is effectively exited.

The following is a section of a job sequence that makes use of the loop stages to run a job repeatedly to process results for different days of the week:

Figure 3. Example of loop used in list mode

Shows an example job sequence set up to run a job repeatedly to process results for different days of the week

The Start Loop stage, dayloop, has List loop selected and properties are set as follows:

Figure 4. List loop properties

Shows the property setting for the list loop in the example job sequence

The Job Activity stage, processresults, properties are:

Figure 5. Process results property

Shows the settings for the job activity in the example job sequence

The job processresults will run five times, for each iteration of the loop the job is passed a day of the week as a parameter in the order monday, tuesday, wednesday, thursday, friday. The loop is then exited and control passed to the next activity in the sequence.