SCHEDULE
Automated Job Submission System
Guide and Reference Manual


Previous Contents Index

3.2.4 Using Strings in Variables

Any alphnumeric string can be used in a variable as long as it is within quotes and doesn't conflict with the date keywords described in Section 3.2.3. When a string is added to another variable element, the two elements are appended. By default the result is a string. Some example of string variable operation:


 
"Today's Date is " +  FORMAT="DD MMMMMMMMMM"  (ADATE "today") 
 
"XXX" + var1 + "YYY" 
 
newvar - "r" 
 

3.3 Job command preprocessing

The commands in a job are run through a pre-processor searching for control instructions and variable replacement expressions before the job is created. This allows the command expressions to read and/or modify aspects of the job before it is submitted. Once this is done, a temporary command file is created and used by the job when it starts.

For example:

  1. A variable named F1 contains the name of a file to copy. The variable F2 contains the destination name and folder. The following command will copy the contents from F1 to F2.


     
     copy ((F1)) ((F2)) 
     
    

    The schedule system will replace ((F1)) and ((F2)) with their corresponding values before creating the temporary command file and starting up the job.

  2. A program always requests two inputs from the running command file. In the example below the command requests today's date and the constant 23


     
     # 
     report 
     ((date today "mm/nn/yy")) 
     23 
     # 
     
    

  3. Check to see if a variable has been set, if not terminate the job.


     
     ((IF_BLANK JOB_DATA_VARIABLE)) 
     rem Job_data_variable not set, will now exit 
     exit 
     ((ENDIF)) 
     
    

3.3.1 Variable types

There are two types of variables available to the preprocessoe: GLOBAL and LOCAL. There is also a group of built-in local variables. Any number of additional local variables can be created. Global variables are any variable created inside EnterpriseSCHEDULE.

3.3.1.1 Job specific local variables

A number of standard job specific local variables are available inside each job. They can be used to refer to details of the job. Some overlap exists between the three types of variables listed below.

Current settings variables - These are the characteristics of the job at the time it is being created.
Example:


$DATE = 20030911 
$DAY = 11 
$FULL_JOB_NAME = [BTESTDIR]TEST 
$HOUR = 11 
$JOB_NAME = TEST 
$MINUTE = 27 
$MONTH =  9 
$P1 = 
$P2 = 
$P3 = 
$P4 = 
$P5 = 
$P6 = 
$P7 = 
$P8 = 
$RESTART = FALSE 
$RESTART_DOWN_COUNT = 0 
$SCHEDULE_SET_ID = 100000 
$SCHEDULE_SET_PARAMETER = 
$SCHEDULE_SET_TAG = 
$SET_ID = 100000 
$SET_PARAMETER = 
$SET_TAG = 
$STEP = 0 
$TIME = 1127 
$YEAR = 2003 

Current job attribute variables - Current job attribute variables are all the static job data fields for the job being submitted.
Example:


SC_ACCOUNT = 
SC_AFTER_DELAYED = 0-00:15:00.00 
SC_CHARACTERISTICS = 
SC_CLI = DCL 
SC_COMMENT = 
SC_COMMENT_Q = 
SC_COMPLETED = TESTUSR,Mail 
SC_CPUTIME = Not set 
SC_CPU_TIME_LIMIT = Not set 
SC_DELAYED = TESTUSR,Mail,Broadcast 
SC_DISK_SPACE = "",0 
SC_DISK_SPACE_Q = "",0 
SC_DOWN_COUNT = infinite 
SC_ESTIMATED = 10,60,100 
SC_EXECUTE_WINDOW = 0-12:00:00.00 
SC_FAILED = TESTUSR,Mail 
SC_FILE = 
SC_FILE_Q = 
SC_FLAGS = Delete,NoHold,Keep,NoPrint,NoRestart,NoRetain 
SC_GENERAL_FLAGS = OpenVMS,History,Fixed_Set_Id 
SC_GF_BLOCK_RUN = 0 
SC_GF_DELETE_AFTER = 0 
SC_GF_FIXED_SET_ID = 1 
SC_GF_NOHISTORY = 0 
SC_GF_UNIX = 0 
SC_GF_WINDOWS = 0 
SC_JOB_NAME = 
SC_JOB_TAG = 
SC_JOB_TAG_Q = 
SC_LAST_COMPLETED = 11-SEP-2003 11:27:37.81 
SC_LAST_START = 11-SEP-2003 11:27:31.23 
SC_LAST_SUBMIT = 11-SEP-2003 11:25:08.22 
SC_LOG_FILE = 
SC_LOG_FILE_Q = 
SC_MEASURED = 3,173,751,11 
SC_METHOD = None 
SC_NAME = [BTESTDIR]TEST 
SC_NEXT_SUBMIT = 
SC_NODE = 
SC_NTF_COMPLETED_BRC = 0 
SC_NTF_COMPLETED_MAIL = 1 
SC_NTF_DELAYED_BRC = 1 
SC_NTF_DELAYED_MAIL = 1 
SC_NTF_FAILED_BRC = 0 
SC_NTF_FAILED_MAIL = 1 
SC_NTF_STARTED_BRC = 0 
SC_NTF_STARTED_MAIL = 0 
SC_NTF_SUBMIT_BRC = 0 
SC_NTF_SUBMIT_MAIL = 0 
SC_OWNER = 00070001 
SC_PARAMETER = "","","","","","","","" 
SC_PARAMETER_Q = "","","","","","","","" 
SC_PLATFORM = OpenVMS 
SC_POST_COM_FILE = 
SC_PRE_COM_FILE = 
SC_PRINTER = 
SC_PRIORITY = 0 
SC_PROTECTION = S:RWED,O:RWED,G:RWED,W:RWED 
SC_QUEUE = SYS$BATCH 
SC_RESIDENT_SIZE = 0 
SC_RESTART_COUNT = 0 
SC_RSC_445 = 0 
SC_RSC_454 = 0 
SC_RSC_544 = 0 
SC_RSC_FRIDAY = 0 
SC_RSC_MONDAY = 0 
SC_RSC_MONTH_END = 0 
SC_RSC_MONTH_START = 0 
SC_RSC_SATURDAY = 0 
SC_RSC_SUNDAY = 0 
SC_RSC_THURSDAY = 0 
SC_RSC_TUESDAY = 0 
SC_RSC_WEDNESDAY = 0 
SC_RSC_YEAR_END = 0 
SC_RSC_YEAR_START = 0 
SC_SF_DELETE = 1 
SC_SF_ENVIORNMENT = 0 
SC_SF_HOLD = 0 
SC_SF_KEEP = 1 
SC_SF_NOTIFY = 0 
SC_SF_PRINT = 0 
SC_SF_PROFILE = 0 
SC_SF_RESTART = 0 
SC_SF_RETAIN = 0 
SC_SHELL = DCL 
SC_SHORT_NAME = TEST 
SC_STARTED = 
SC_STARTUP_WINDOW = 0-00:15:00.00 
SC_STATUS = %x00030001 
SC_SUBMITTED = 
SC_SUBMIT_FLAGS = Delete,NoHold,Keep,NoPrint,NoRestart,NoRetain 
SC_UP_COUNT = 13 
SC_USER = TESTDIR 
SC_VERSIONS_OF_LOG = 
SC_WSDEFAULT = 0 
SC_WSEXTENT = 0 
SC_WSQUOTA = 0 
 
 

Controling queue entry variables - These variables originate from the queue entry that is controlling this job.
Example:


SQ_ABORTING = 0 
SQ_DELAYED = 0 
SQ_ENTERED_ON = 11-SEP-2003 11:27:39.50 
SQ_ENTRY = 1742 
SQ_HOLD = 0 
SQ_INITIATED_ON = 11-SEP-2003 11:27:39.48 
SQ_NAME = [BTESTDIR]TEST 
SQ_PENDING_NEXT = 0 
SQ_REMOTE_JOB = 0 
SQ_SET_ID = 100000 
SQ_SET_PARAMETER = 
SQ_SET_TAG = 
SQ_STEP = 0 

3.3.2 General syntax rules

The command list searches for appropriate tokens to substitute or evaluate. As each line is completed it is output to the command file or script.

Each instruction to be processed is defined as:


 
    (( xxxxx )) 
 

The "((" and "))" delimit the text that is to be replaced by the token "xxxxx". The token can be control instructions or values to look up. The "((" and "))" and all material in between are replaced by the evaluation.

3.3.2.1 General rules

The general rules of syntax are:

  1. The "((" and "))" must appear on the same line of text.
  2. White space inside is ignored. The template file is treated as a continuous character sequence include newline characters with the exception of control tokens which must be on one line.
  3. Variable and control names are case insensitive.
  4. Ending a control sequence with "*" suppresses the next newline. (i.e. ((IF_ZERO*)), ((DO abc*)) ...)
  5. Ending a control sequence with "-" prevents the echoing out of the sequence if it is unknown. (i.e. ((ABC-)), ((DO ABC-)) ...)
  6. Ending a control sequence with "+" causes any interior single quote mark " to be replaced by a pair of quote marks "". (i.e. ((ABC+)) )
  7. Anywhere a variable can be placed a string constant "xxx" can be used.
  8. Ending a control sequence with "%" Ex: ((xxxx%)) indicates replace all single "\" with a double "\\".

3.3.3 Single Variables

There are two type of variables:

Global - those that are in the EnterpriseSCHEDULE database.

Local - those that are only present for the duration of the pre-processing.

There is also a set of job specific local variables (see Section 3.3.1.1. Additional local variables can be created using the SET command described below.


 
   (( name_of_variable )) 
 

In a command file this is any variable known to the EnterpriseSCHEDULE system. If it is the same directory as the job, the path portion of the name can be left off.

For example:


 
 (( TEST_VARIABLE_1 )) 
 (( /SYS/FRIDAY )) 
 (( [MASTER]CONTROL_DATE )) 
 (( \SP\START_FLAGS )) 
 (( SC_NAME )) 
 (( $P1 )) 
 

3.3.4 ARRAY variables

When creating array variables, the variable name is computed using a DO loop counter and then treated in the same manner as a SINGLE variable.

Example:


 
    (( name_of_variable_in_heap_!4ZL )) 
 

"_!4ZL" (or any numeric fao formating code can be used) is evaluated using the name string as a formatting string to the fao service with the do counter as the variable.

3.3.5 Job Command Examples

The following examples illustate the syntax for commands within jobs.
  1. Comments - A block of COMMENTS can be placed anywhere. Any text within a comment is not writen to the output.


     
        ((COMMENT)) comment ((ENDCOMMENT)) 
     
    

    Example:


     
        ((COMMENT)) 
        This is the headcommand and will not be written out 
        ((ENDCOMMENT)) 
     
    

    An alternate form for a comment is:


     
        ((! comment )) 
     
    

    Example:


     
        ((!This is a command and will not be written out)) 
     
    

  2. IF Statement - An IF section can delineate conditional statements. The variations are:


     
        ((IF_BLANK variable)) ... ((ELSE)) ... ((ENDIF)) 
        ((IF_NOT_BLANK variable)) ... ((ELSE)) ... ((ENDIF)) 
        ((IF_ZERO variable)) ... ((ELSE)) ... ((ENDIF)) 
        ((IF_NOT_ZERO variable)) ... ((ELSE)) ... ((ENDIF)) 
        ((IF_EQUAL variable variable)) ... ((ELSE)) ... ((ENDIF)) 
        ((IF_NOT_EQUAL variable variable)) ... ((ELSE)) ... ((ENDIF)) 
     
    

    In this example, the words "All finished" be written to the output file only if the count is zero.
    Example:


     
        ((IF_ZERO COUNT))All finished((ENDIF)) 
     
    

    Example:


     
        (( IF_NOT_BLANK /MASTER/FILE_NAME *)) 
        EXEPROC ((/MASTER/FILE_NAME)) 
        (( ELSE *)) 
        ECHO No master file specified! 
        (( ENDIF *)) 
     
    

    In the EQUAL conditions the variable can be either a symbol name or a string constant as in "ssss".
    Example:


     
        ((IF_EQUAL MODE "TEST_MODE)) Skipping the job ((ENDIF)) 
     
    

  3. SET Command - A SET command will create or modify a local variable. Local variables only exist for the duration of the pre-processing.


        ((SET variable value)) 
     
    

    Example:


     
        ((SET CONTROL_FLAG "START_NOW" *)) 
     
    

    This will set a variable and the "*" will prevent this line from creating a blank line in the output.

  4. Preset DO loop - A DO section repeats the number of times indicated by the control variable.


     
        ((DO max_count_variable)) ... ((ENDDO)) 
     
    

    Example:


     
        ((DO 4))X((ENDDO)) 
     
    

    This example will result in the string "XXXX" to be written out.


     
         ((SET A_0000 "ONE")) 
         ((SET A_0001 "TWO")) 
         ((DO 2)) 
         ((A_!4ZL)) 
         ((ENDDO) 
     
    

    This simple example produces the following result:


     
         ONE 
         TWO 
     
    

  5. Dates - A date can be inserted as follows:


     
        ((DATE [date_expression] [date_format])) 
     
    

    Example:


     
        ((DATE TODAY "DD/NN/YY"))  or ((DATE)) 
     
    

    The Date expression can be a variable name or a string constant that follows the rules for either absolute or delta time expressions.
    Frequently used data formats are:


     
       "DD/NN/YY"  1/10/03 
       "DD-MMMMMMMMM-YYYY" 1-October-2003 
       "MMMMMMMMMBDD,YYYY" October 1, 2003 
       "WWWWWWWWWW"  Wednesday" 
       "TTTTTTTT"  12:04:45 
       "WWWWWWWWWWBTTTTT" Wednesday 12:04 
     
    

    The following table is the full list of date strings that may be inserted.
    Date String Description
    A Each A is replaced by an alphabetic character from the field's contents. All others are replaced with an asterisk.
    B The letter B is replaced by a blank at that position.
    D Each D is replaced by the corresponding digit of the day of the month. DD is recommended.
    E Each E is replaced by the corresponding digit of the day of the month. Includes leading blanks.
    F Each F is replaced by the corresponding digit of the day of the month. Includes leading zeros.
    J Each J is replaced by the corresponding digit of the Julian date. JJJ is recommended.
    L A L placed at the left of an edit string will cause the field to be left justified.
    M Each M is replaced by the corresponding letter of the name of the month. An edit string of M(9) prints the entire name of the month.
    N Each N is replaced by a digit of the number of the month. NN is recommended.
    O Each O is replaced by a digit of the number of the month. Skip leading blanks.
    Q Each Q is replaced by a digit of the number of the month. Including leading zeros.
    P P for PM. Nothing for AM.
    U Time of day using 12 hour clock.
    Y Each Y is replaced by the corresponding digit of numeric year. YY or YYYY is recommended.
    T Each T is replaced by a character of the time. The time is displayed as HH:MM:SS.DD.
    W Each W is replaced by the corresponding letter from the name of the day of the week. An edit W(9) prints the entire name.
    X Each X is replaced by one character from the SYS$ASCTIM representation of the date
    , A comma will be inserted at that position.
    . A period will be inserted at that position.
    - A dash will be inserted at that position
    / A slash will be inserted at that position.

  6. Includes - Input can be redirected to another job using the following syntax:


     
        ((INCLUDE name_to_include_from [a1 ... a9])) 
     
    

    Example:


     
        ((INCLUDE MY_CONTROL_JOB 12 xyz)) 
     
    

    This copies the command section from the job MY_CONTROL_JOB a into the current job and substitutes %%1%% and %%2%% with 12 and xyz. This can be done recursively. The entire line on which this statement appears is replaced by the command section of the specified job. The INCLUDE statement should appear on a line by itself. A maximum of 9 arguments may be passed to the command section.
    Arguments:
    The arguments after the include will be substituted using the following syntax in the command section


     
    %%argument_number%% 
     
    

    eg


     
    %%1%% %%2%% 
     
    

  7. Includefile - Input from a file can be included in a job using the following syntax:


     
        ((INCLUDEFILE file_name_to_include [a1 ... a9])) 
     
    

    Example:


     
        ((INCLUDEFILE MYFILE 12 xyz)) 
     
    

    This copies the contents of a file MYFILE into the current job and substitutes %%1%% and %%2%% with 12 and xyz in the file. This can be done recursively. The entire line on which this statement appears is replaced by the contents of the specified file. The INCLUDEFILE statement should appear on a line by itself. A maximum of 9 arguments may be passed to the included file.
    Arguments:
    The arguments after the include will be substituted using the following syntax in the command section


     
    %%argument_number%% 
     
    

    eg


     
    %%1%% %%2%% 
     
    

  8. Symbol table - The internal symbol table can be printed to the output stream by:


     
        ((SYMBOLS))   or   ((SYMBOLS format_string)) 
     
    

    Example:


     
        ((SYMBOLS "$%s == ""%s""")) 
     
    

    the default format_string is "%s = %s"


Previous Next Contents Index