The following examples illustrate the syntax for commands within jobs.
1 Comments - A block of COMMENTS can be placed anywhere. Any
text within a comment is not written to the output.
((COMMENT)) comment ((ENDCOMMENT))
Example:
((COMMENT))
This is the command 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 preprocessing.
((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/09
"DD-MMMMMMMMM-YYYY" 1-October-2016
"MMMMMMMMMBDD,YYYY" October 1, 2016
"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 system, 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 xx))
This copies the command section from the job MY_CONTROL_JOB a into the current job and substitutes %%1%% and %%2%% with 12 and xx. 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.
Arguments:
The arguments after the include will be substituted using the following syntax in the command section
%%<argument_no>%%
eg
%%1%% etc.
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 xx))
This copies the contents of a file MYFILE into the current job and substitutes %%1%% and %%2%% with 12 and xx 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.
Arguments:
The arguments after the include will be substituted using the following syntax in the included file
%%<argument_no>%%
eg
%%1%% etc.
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"