SCHEDULE
Automated Job Submission System
Guide and Reference Manual


Previous Contents Index

Chapter 3
Resource Variables and Preprocessing

This chapter presents detailed descriptions of advanced aspects of job scheduling using SCHEDULE . These features include:

3.1 Advanced job interaction

This section explains advanced job interaction and gives examples of how to gain even more control of your job runs. While initiates ( Section 2.1.7) and prerequisites ( Section 2.1.9) allow a full range of interactivity between jobs, the advanced techniques described below can add an extra degree of programmability to your job runs.

In a standard job interaction sequence, when all prerequisites are completed the job is run and then the initiate list is processed, executing connected jobs. However, suppose you want to suppress the job if another job is currently running? Maybe you want to limit the number of jobs that can access a resource like a database at the same time. Or maybe you want to be able to set a variable that shuts off a whole section of your job group or even the whole group when you see fit. This is where advanced job programming comes into the picture.

Unlike initiates and prerequisites, a job's general resource list is not connected to other jobs. Instead, the commands in a resource list perform variable evaluation dictating the behavior of the job. Depending on the results of the variable evaluation, the job run can be suppressed, put in a wait state, or a new value can be assigned to a variable.

In addition to the resource list, the initiate list, the prerequisite list and the end actions list can also be used for advanced job interaction, though in different ways. Each of these methods is explained later in this section.

3.1.1 How jobs are processed

In order to understand advanced job interaction, you should first understand how jobs are processed and what techniques can be used to add to that process. This list illustrates the order that job lists are processed and the type of advanced job processing that can be performed using these lists.

  1. Job is initiated - A job can be initiated either by a start time, a submit command or another jobs initiate list)
  2. Prerequisites - The first step of a job is the processing of the prerequisites list. The prerequisite job checks to see if the prerequisites have successfully executed. If all prerequisites have been executed, the next step occurs. The prerequisite list can include IF statements that include or exclude particular jobs.
  3. Resources - The resource list is where the bulk of advanced job programming occurs. Here IF-THEN statements are processed that can check or alter the value of a variable, suppress a job run or cause a wait to occur. These techniques will prove very useful.
  4. Job is run - The job is submitted into batch using the attributes assigned for the job.
  5. End Action - The end action list contains post job processing that occurs whether or not the job is successful. The end action list can include IF-THEN statements that checks or alters the value of a variable.
  6. Initiates - The initiates list contains the jobs that will be executed upon successful completion of the current job. The initiate list can include IF statements include or exclude particular jobs. Other conditions can also be used to control the next job step.

3.1.2 Advanced job examples

The following examples illustrate some situations where advanced job interaction can be used. While reading these descriptions, see if they apply to a job scheduling challenge you may have in your job set. You can most likely use the advanced job interaction tools to solve this challenge.

3.1.3 Syntax of job interaction

This section displays the syntax that can be used to perform advanced job interaction in Schedule. There are four list types that can be used in advanced job interaction. These are:
List type Allowable constructs
Prerequisites list Job names,IF expression
Resource list !Comment

SET variable=expression

IF expression THEN WAIT

IF expression THEN SUPPRESS_RUN

IF expression THEN SET variable=expression

IF FILE_NOT_FOUND THEN expression

End action list !Comment

SET variable=expression

IF expression THEN SET variable=expression

Initiates list Job name, IF expression


IF-THEN-SET

Make a decision as to whether a variable will be updated.

Usage: Resource list/end action list

If the expression evaluates to true then variable will be updated. Other wise the statement is ignored and the next statement is evaluated.

The operator FILE_NOT_FOUND can be used in any IF-THEN statement. It tests for the presence of one or more files and evaluates to true if the file is not present. The file name specification can include wildcards.


Format

IF expression THEN SET variable = expression


Examples

#1

IF run_count == 5 THEN SET total=counter-5 
      

#2

IF FILE_NOT_FOUND test1.dat THEN set test=0 
      


IF-THEN-FAILRUN

Make a decision as to whether the job run should be failed.

Usage: Resource list

If the expression evaluates to true then the job will fail and no other resource statements are evaluated. The resource list will not be evaluated again. If the expression evaluates to false than the statement is ignored and the next statement is evaluated.

The operator FILE_NOT_FOUND can be used in any IF-THEN statement. It tests for the presence of one or more files and evaluates to true if the file is not present. The file name specification can include wildcards.


Format

IF expression THEN FAILRUN


Examples

#1

IF fail_var == "YES"  THEN FAILRUN 
      

#2

IF FILE_NOT_FOUND test1.dat THEN FAILRUN 
      


IF-THEN-SUPPRESS_RUN

Make a decision as to whether the job run should be suppressed.

Usage: Resource list

If the expression evaluates to true then the job is not executed and no other resource statements are evaluated. The resource list will not be evaluated again. If the expression evaluates to false than the statement is ignored and the next statement is evaluated.

The operator FILE_NOT_FOUND can be used in any IF-THEN statement. It tests for the presence of one or more files and evaluates to true if the file is not present. The file name specification can include wildcards.


Format

IF expression THEN SUPPRESS_RUN


Examples

#1

IF total != 5 THEN SUPPRESS_RUN 
      

#2

IF FILE_NOT_FOUND test1.dat THEN SUPPRESS_RUN 
      


IF-THEN-WAIT

Make a decision as to whether the job should go into a wait state.

Usage: Resource list

If the expression evaluates to true then the job waits and no other resource statements are evaluated. The entire resource list will be re-evaluated from the begininning at a later time. If the expression evaluates to false than the statement is ignored and the next statement is evaluated.

The operator FILE_NOT_FOUND can be used in any IF-THEN statement. It tests for the presence of one or more files and evaluates to true if the file is not present. The file name specification can include wildcards.


Format

IF expression THEN WAIT


Examples

#1

IF complete >= 5 THEN WAIT 
      

#2

IF FILE_NOT_FOUND test1.dat THEN WAIT 
      


INCLUDE

Includes the resource/end actions of another job.

Usage: Resource list/end actions list


Format

INCLUDE job_name


Examples

#1

 
 
 
 
include /jobs/typical_job 
include /jobs/test/example_job 
 
 
      


SET

Set the value of a single variable.

Usage: Resource list/end actions list


Format

SET variable=expression


Examples

#1

SET next_var = 5 
      

3.1.4 Operators

This section defines the fundamental operators of Advanced job programming in SCHEDULE. Note that there are in some cases more than one way to define an expression.

Table 3-1 Assignment operator
Operator Description
A = B Assigns the value of B to A

Table 3-2 Integer operators
Operator Alternate Description
A < B A .LT. B Evaluates to true if A is less than B
A > B A .GT. B Evaluates to true if A is greater than B
A <= B A .LE. B Evaluates to true if A is less than or equal to B
A >= B A .GE. B Evaluates to true if A is greater than or equal to
A == B A .EQ. B Evaluates to true if A is equal to B
A != B A .NE. B Evaluates to true if A is not equal to B
A + B   Evaluates to the sum of A and B
A - B   Evaluates to the difference between A and B
A * B   Evaluates to the product of A and B
A / B   Evaluates to the quotient of A and B
A % B   Evaluates to the integer remainder of B and A

Table 3-3 String operators
Operator Description
A .LTS. B Evaluates to true if A is less than B
A .GTS. B Evaluates to true if A is greater than B
A .LES. B Evaluates to true if A is less than or equal to B
A .GES. B Evaluates to true if A is greater than or equal to B
A .NES. B Evaluates to true if A is not equal to B
A .EQS. B Evaluates to true if A is equal to B

Table 3-4 BOOLEAN operators
Operator Description
A .AND. B Evaluates to true if both A and B evaluate to true
A .OR. B Evaluates to true if either A or B evaluate to true
.NOT. A Evaluates to true if A evaluates to false
FILE_NOT_FOUND Evaluates to true if filename is found


Previous Next Contents Index