Previous | Contents | Index |
This chapter presents detailed descriptions of advanced aspects of job scheduling using SCHEDULE . These features include:
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.
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.
IF valve == off THEN SUPPRESS_RUN |
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 |
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.
IF expression THEN SET variable = expression
#1 |
---|
IF run_count == 5 THEN SET total=counter-5 |
#2 |
---|
IF FILE_NOT_FOUND test1.dat THEN set test=0 |
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.
IF expression THEN FAILRUN
#1 |
---|
IF fail_var == "YES" THEN FAILRUN |
#2 |
---|
IF FILE_NOT_FOUND test1.dat THEN FAILRUN |
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.
IF expression THEN SUPPRESS_RUN
#1 |
---|
IF total != 5 THEN SUPPRESS_RUN |
#2 |
---|
IF FILE_NOT_FOUND test1.dat THEN SUPPRESS_RUN |
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.
IF expression THEN WAIT
#1 |
---|
IF complete >= 5 THEN WAIT |
#2 |
---|
IF FILE_NOT_FOUND test1.dat THEN WAIT |
Includes the resource/end actions of another job.Usage: Resource list/end actions list
INCLUDE job_name
#1 |
---|
include /jobs/typical_job include /jobs/test/example_job |
Set the value of a single variable.Usage: Resource list/end actions list
SET variable=expression
#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.
Operator | Description |
---|---|
A = B | Assigns the value of B to A |
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 |
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 |
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 |