SCHEDULE
Automated Job Submission System
Guide and Reference Manual


Previous Contents Index

3.1.5 Variables

The purpose of a variable is to allow job switching and wait state controls that go beyond the traditional prerequisites and initiates. The values contained in variables can exist either in the database or as a local, temporary variable. There are three basic variables types:
Variable type Description
Integer Variable holds an interger value
String Variable is a character string
Boolean Variable holds a True/False value.

Values considered True:

Any string that starts with 'T', 't','Y', or 'y'

Any odd integer

Values considered False

Any string that does start with 'T','t','Y','y' Any Even integer

An expression is any valid relationship using a variable. For example:


 
variable1 
variable1 .eq. variable2 
(variable1 .gt. variable2) .and. (variable3 .gt. 30) 
(variable .ne. variable2) .or. (variable3 .le. 200) 
variable1 + variable3 * 40 .ge. 100 
 

A variable's value is saved in the database where it can be accessed or modified with the SET command by any number of jobs . Variables can also be created or modified on the command line or in the SCHEDULE GUI. An example of a stored variable is shown below.


 
Examples: 
 
var1                   ! The variable name 
/dir1/var              ! A more complete name 
/miller/dir1/var1      ! A fully qualified variable 
 

A temporary variable is associated with the currently running job and it's value exists only for the duration of the processing of the list it is used in. The following run-time defined temporary variables only hold values after the job command list is processed so may only be used in the initiates or End actions list:

In addition there are time-based temporary variables that can be used to bring time, day, month or year into the evaluation of variables. Unlike the other temporary variables, time based variables may be used in any of the lists. For instance if you only want to suppress a job run if it is the 5th of the month you can enter the line:


 
IF $DAY==5 THEN SUPPRESS_RUN 
 

The time-based temporary variables are:

SCHEDULE parameters can also be used as temporary variables. The parameter variables are"

3.1.6 Where to use advanced job interaction

There are four SCHEDULE job lists in which the advanced job interaction described above can be used. There are specific ways you can use each of these lists to enhance your job runs and micro-manage job interaction. The lists that can include these advanced evaluations are:

3.2 Using Enhanced Variables

In addition to simple resource string variables EnterpriseSCHEDULE supports a rich set of variable expressions that feature simple and complex math expressions, date expressions and character expressions. This extends the power of variables and allows for run time calculation of dates and other values.

Variable expressions are evaluated in an order and priority similar to common math expressions and support the use of parentheses. The expression is evaluated during a job submission when the job references the variable.

3.2.1 Enhanced variable basic structure

Variable expressions can use normal arithmatic and relational operators as well as parentheses to specify the order and precedence of the operations.

Table 3-5 Expression operators
Operator Alternate Description
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 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 integer remainder of B and A

Expanded variable examples:


 
A+(B*5) 
b * 2 + c / 2 
X+(A>B)/(Y*Z) 
var1/(var2-var3) 
(a < c) * 23 + (a > c) * 53 
 

3.2.2 Formatting math based variables

Variable expressions can be made to be desired format by placing a symbol or phrase before an expression. For instance if you want an expression to be resolved to an integer, you can put INTEGER before the expression. A minus sign negates the value of the expression. This allows the value of the variable to be formatted as needed by the application.

Table 3-6 Math based variable operators
Operator Description
- Produces the negative value of the expression.
.NOT. or ! Produces the inverse value of a boolean expression.
FILE_NOT_FOUND Produces a 1 if file in parentheses is found. 0 if not.
FORMAT="Picture String" Produces the formatted value of the expression. See Section 3.3.5.
INTEGER Produces the integer value of the expression.
FLOAT Produces the floating point value of the expression.
ADATE Produces the absolute date value of the expression.
DDATE Produces the delta date value of the expression.

Math Based variable example:


 
FLOAT(X*Y/Z) 
INTEGER(VARB-VARA) 
FORMAT="DD-MMMMMMMMM-YYYY" TODAY 
-(A+B) 
FORMAT="DDMMMYY" ("BOY" + 3 months) 
 

3.2.3 Using Dates in Variables

Dates can be used in variables expressions and can be calculated using math operators and date units. For instance two days added to Wednesday will calculate as Friday. A month added to today will produce today's date, one month from today.

Table 3-7 Date Keywords
Expression Alternate Description
BOY BEGINNING_OF_YEAR First day of the upc year.
EOY END_OF_YEAR Last day of the year.
BOM BEGINNING_OF_MONTH First day of the month.
EOM END_OF_MONTH Last day of the month.
BOM BEGINNING_OF_MONTH First day of the month.
MONDAY - SUNDAY   Days of the week.
MONDAY_THIS_WEEK - SUNDAY_THIS_WEEK   The "THIS_WEEK" word means the day of the current week.
TODAY   Today's date.
TOMORROW   Tomorrow's date.
YESTERDAY   Yesterday's date.
NOW   The current date and time.

Table 3-8 Date Units
Expression Alternate Description
DAY DAYS A day. A 24 hour period.
HOUR HOURS An hour (60 minutes).
SECOND SECONDS A second.
YEAR YEARS A year.
MONTH MONTHS A month.
WEEK WEEKS A week.

Rules for Dates:

Table 3-9 Date Variable Examples
Expression Result
"12-jan-2007" + 1 MONTH February 12, 2007, 0:00
ADATE ("BOM") + 12 DAYS 12 days after first of this month
ADATE ("MONDAY") + 2 WEEKS 2 weeks from next Monday
ADATE ("MONDAY_THIS_WEEK") - 2 WEEKS 2 weeks before Monday
"NOW" + 12 HOURS 12 hours from the current time
ADATE ("END_OF_YEAR") - 12 DAYS + 2 HOURS "2:00 AM, 12 days before the end of the year"
ADATE ("bom") + 2 MONTH - 1 DAY Last day of next month
FORMAT="ZZ9" (ADATE "eoy" - "boy")/1 DAY + 1 Number of days in the current year

The following example displays the current value of a date expression:


 
Schedule> lsvar -full variable1 
 
\myfolder\variable1 
    Comment                   = 
    Type                      = Expression 
    Value                     = "TODAY" + 1 DAY 
    Result                    = August 22, 2006,  0:00 
 


Previous Next Contents Index