Chapter 4. Dynamic Variables Control Statements

Table of Contents

4.1. Overview
4.2. %% Control Statement
4.2.1. SET
4.2.2. GLOBAL
4.2.3. IF/ELSE/ENDIF
4.3. OPC Control Statement
4.3.1. SCAN
4.3.2. SETFORM
4.3.3. SETVAR
4.3.4. BEGIN
4.3.5. END

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.

ItemDescription

%% Control Statement

The JCL syntax starting with '%%' represents %% dynamic control statements.

OPC Control Statement

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.

Note

  1. For more information about the textrun tool, refer to OpenFrame Tool Reference Guide.

  2. For more information about the textrun subject settings, refer to OpenFrame Configuration Guide.

The following describes the %% control statement.

  • Syntax

    %%Variable Name
    FieldDescription

    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.

Operation

OpenFrame supports the following operations.

  • OperationDescription

    SET

    Assigns a value to a variable.

    GLOBAL

    Retrieves a list of variables described in a file of a specific path.

    IF/ELSE/ENDIF

    Sets the condition to bypass or execute later steps depending on the results of the condition.

Note

Any other operations than those described in this table are not supported.

System Variables

OpenFrame supports the following system variables for the %% control statement.

System VariableDescription

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.

  • 1: Sunday

  • 2: Monday

  • 3: Tuesday

  • 4: Wednesday

  • 5: Thursday

  • 6: Friday

  • 0: Saturday

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
    FieldDescription

    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.

    • CALCDATE: Calculates the date and displays it in 6 digits (yymmdd).

    • $CALCDTE: Calculates the date and displays it in 8 digits (yyyymmdd).

    • $WCALC: Calculates the date and displays it in 8 digits (yyyymmdd).

    • $JULIAN: Converts Gregorian date (yyyymmdd) to Julian date (yyyyddd).

    • SUBSTR: Extracts a substring from a string.

    • PLUS: Adds the previous value and the current value.

    • MINUS: Subtracts the later value from the current value.

    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

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.

Note

  1. For more information about the textrun tool, refer to OpenFrame Tool Reference Guide.

  2. For more information about the textrun subject settings, refer to OpenFrame Configuration Guide.

The following describes the OPC control statement.

  • Syntax

    //*%OPC △¹Operation △¹Operand
    ItemDescription

    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.

Operations

OpenFrame supports the following operations.

ItemDescription

SCAN

Only processes the operations that follow a SCAN statement but does not process the operations that precede a SCAN statement.

SETFORM

Specifies the format of the date variable.

SETVAR

Specifies the value of the variable.

BEGIN

Specifies the beginning of the domain.

END

Specifies the end of the domain.

Note

Any other operations than those described in this table are not supported.