Table of Contents
This chapter describes dynamic variable control statements and their operands.
OpenFrame supports two types of dynamic variable control statements. The two types of syntax cannot be used together.
The following is the list of dynamic variable control statements.
Item | Description |
---|---|
The JCL syntax starting with '%%' represents %% dynamic control statements. | |
The JCL syntax starting with '%OPC' represents OPC dynamic control statements. |
A %% control statement starts with the '%%' JCL statement syntax. You can use %% control statements anywhere in the JCL regardless of syntax including in-stream data. If '%%' is preceded by a command or variable, OpenFrame recognizes the statement as a %% control statement.
To submit a JCL including %% control statements, the job must be submitted using the textrun tool. To run textrun, the value of the USE key in the AUTOEDIT section of the textrun subject must be set to YES.
For more information about the textrun tool, refer to OpenFrame Tool Reference Guide.
For more information about the textrun subject settings, refer to OpenFrame Configuration Guide.
The following describes the %% control statement.
Syntax
%%Variable Name
Field | Description |
---|---|
Variable Name | If '%%' precedes a specific string, the statement is considered as %% control statement. The variable name can be a simple variable or an operation supported by OpenFrame. The types of operations and system variables are described below. |
OpenFrame supports the following operations.
Operation | Description |
---|---|
Assigns a value to a variable. | |
Retrieves a list of variables described in a file of a specific path. | |
Sets the condition to bypass or execute later steps depending on the results of the condition. |
Any other operations than those described in this table are not supported.
OpenFrame supports the following system variables for the %% control statement.
System Variable | Description |
---|---|
TIME | Displays the system's current time in hhmmss format. |
DAY | Displays the day of the system's current date in dd format. |
ODAY | Displays the day of the given date in dd format. |
RDAY | Displays the day of the system's current date in dd format. |
RWDAY | Displays the system's current day of the week as a single digit.
|
OJULDAY | Displays the given date in Julian date format (nnn). |
DATE | Displays the current date of the system in yymmdd format. |
$DATE | Displays the current date of the system in yyyymmdd format. |
ODATE | Displays the given date in yymmdd format. |
$ODATE | Displays the given date in yyyymmdd format. |
$RDATE | Displays the given date in yyyymmdd format. |
RDATE | Displays the given date in yymmdd format. |
OMONTH | Displays the month of the given date in mm format. |
RMONTH | Displays the month of the given date in mm format. |
OYEAR | Displays the year of the given date in yy format. |
$OYEAR | Displays the year of the given date in yyyy format. |
RYEAR | Displays the year of the given date in yy format. |
$RYEAR | Displays the year of the given date in yyyy format. |
OCENT | Displays the first two digits of the given date in yy format. |
BLANKn | Displays n blanks. |
RN | OpenFrame only supports syntax to avoid errors. |
Assigns a value to the %% variable specified after the SET statement.
Syntax
%%SET %%Variable Name = Expression
Field | Description |
---|---|
Variable Name | Specifies a variable name to be assigned to a value in the form of '%% variable name' after the SET statement. |
Expression | Specifies the expression to be assigned to the variable name. An integer variable or expression can be specified. If the variable is not prefixed with '%%', it is considered as number or string. The following variables can only be used in expressions.
Numerical, character-type variables, and system-designated variables can be described in the expression. |
Syntax
The following example assigns values to variables A and B on SET statement. In this example, the values assigned to A and B are '100' and '300', respectively.
%%SET %%A = 100 %%SET %%B = %%A + 200
The following example assigns values to variables C, D, and E on SET statement. In this example, if the entered date is '20191231', the values assigned to C, D, and E are '20191226', '191226', and '191229', respectively.
%%SET %%C = %%CALCDATE %%$ODATE - 5 %%SET %%D = %%$CALCDTE %%$ODATE - 5 %%SET %%E = %%D %%PLUS 3
The following example assigns values to variables F and G on SET statement. In this example, the variable F stores string 'OPENFRAME'. The variable G stores 'OPEN', which is a 4-digit value from the first byte of the string stored in F.
%%SET %%F = OPENFRAME %%SET %%G = %%SUBSTR %%E 1 4
Allows you to call variables stored in a specific file. This has the advantage of not having to specify the same SET statements every time in the JCL.
Syntax
%%GLOBAL File Name
Field | Description |
---|---|
File Name | Specifies the file name in which the variable list is stored. It is specified after the GLOBAL statement. |
Sets the condition to bypass or execute later steps depending on the results of the condition. The ELSE statement can only be used in conjunction with an IF statement, and the IF statement must be terminated with the ENDIF statement. It also allows multiple IF statements be nested.
Syntax
%%IF %%Variable Name Conditional Statement AAA %%ELSE BBB %%ENDIF
Field | Description |
---|---|
Conditional Statement | The conditions that can be specified in the IF statement are as follows.
|
Syntax
The following example shows how to use an IF/ELSE/ENDIF statement. In this example, if the specified date is yyyymmdd, the first two digits yy are stored in the variable S. If the value of yy is greater than 20, the value of the variable X is 1, otherwise it is 0.
%%SET %%T = %%$ODATE %%SET %%S = %%SUBSTR 1 2 %%IF %%S GT 20 %%SET %%X = 1 %%ELSE %%SET %%X = 0 %%ENDIF
An OPC control statement starts with '//*%OPC' JCL statement syntax. You can use OPC control statements anywhere in the JCL regardless of the syntax.
To submit a JCL including OPC control statements, the job must be submitted using the textrun tool. To run textrun, the USE item in the TWS section of the textrun subject in the OpenFrame Configuration must be set to YES.
For more information about the textrun tool, refer to OpenFrame Tool Reference Guide.
For more information about the textrun subject settings, refer to OpenFrame Configuration Guide.
The following describes the OPC control statement.
Syntax
//*%OPC △¹Operation △¹Operand
Item | Description |
---|---|
Operation | Defines an operation that follows '//*%OPC'. For more information about supported operations, refer to Operation. |
Operand | Defines an operand followed by one or more spaces after the operation. Operands have different operation types. |
OpenFrame supports the following operations.
Item | Description |
---|---|
Only processes the operations that follow a SCAN statement but does not process the operations that precede a SCAN statement. | |
Specifies the format of the date variable. | |
Specifies the value of the variable. | |
Specifies the beginning of the domain. | |
Specifies the end of the domain. |
Any other operations than those described in this table are not supported.
Processes only the operations that follow a SCAN statement and does not process those preceding it.
Syntax
//*%OPC SCAN
Specifies the format of a data variable.
Syntax
//*%OPC SETFORM Date Variable=(String Format)
Item | Description |
---|---|
Date Variable | Specifies a date variable to apply the specified date format. Valid date variable in OpenFrame is OCDATE. |
String Format | Specifies the format of a date variable. The following keywords are currently supported by OpenFrame. Any characters that do not corresponding to the following are considered as strings.
|
Example
The following example specifies an OCDATE format with an SETFORM statement. If the given OCDATE is '19980201', the OCDATE result is '032011998'.
//*%OPC SETFORM OCDATE=(DDDDDCCYY)
Specifies the value of a variable. There are two types of usage currently supported by OpenFrame. When using the SETVAR syntax, an error occurs if the date variable and unit do not match.
Syntax
//*%OPC SETVAR Variable=(Date Variable {+|-} nnnTT) //*%OPC SETVAR Variable=('String')
Item | Description |
---|---|
Variable | Specifies the variable name. Variable names must start with 'T'. |
Date Variable | Specifies the date variable. Valid date variables in OpenFrame are OCDATE, OYYY, OYY, OMM, and ODD. |
nnn | Specifies numbers between 0 and 999. |
TT | Specifies the unit. Valid units in OpenFrame are as follows.
|
Example
The following example specifies variables on SETVAR statement. If the specified OCDATE is '19980201', the TAA value becomes '19990507'.
//*%OPC SETVAR TAA=(OCDATE+1YR)
Specifies the beginning of the domain. A BEGIN statement must be used along with an END statement. BEGIN-END domain cannot overlap with other BEGIN-END domains. If the conditional expression defined in a COMP parameter is true, then the domain will operate, and if false, then the domain will not operate.
Syntax
//*%OPC BEGIN ACTION={INCLUDE|EXCLUDE|NOSCAN},COMP((Expression 1).{EQ|NE|GE|GT|LE|LT}.(Expression 2))
Item | Description |
---|---|
INCLUDE | Includes the domain in the job. |
EXCLUDE | Excludes the domain from the job. Not currently available. If specified, it operates in the same way as INCLUDE. |
NOSCAN | Specifies that the area included in the domain is not to be substituted. Not currently supported. If specified, it operates in the same way as INCLUDE. |
EQ | Specifies the conditional operator as 'equal to'. |
NE | Specifies the conditional operator as 'different'. |
GE | Specifies the conditional operator as 'greater than or equal to'. |
GT | Specifies the conditional operator as 'greater than'. |
LE | Specifies the conditional operator as 'less than or equal to'. |
LT | Specifies the conditional operator as 'equal to'. |
Example
The following example shows how to use a BEGIN statement. If the given OCDATE is '19980507', the conditional expression of the COMP parameter will be true and the domain will operate, and the TBB variable set on SETVAR will be applied.
//*%OPC BEGIN ACTION=INCLUDE,COMP(&OCDATE..EQ.(19980507)) //*%OPC SETVAR TBB=(OCDATE+1YR) //*%OPC END ACTION=INCLUDE
Specifies the end of the domain.
Syntax
//*%OPC END ACTION={INCLUDE|EXCLUDE|NOSCAN}
Item | Description |
---|---|
INCLUDE | Includes the domain in the job. |
EXCLUDE | Excludes the domain from the job. Not currently supported. If specified, it operates in the same way as INCLUDE. |
NOSCAN | Specifies that the area included in the domain is not to be substituted. Not currently supported. If specified, it operates in the same way as INCLUDE. |