:GENERATE

Use :GENERATE statements to control how script lines are handled during execution. This statement lets you determine which script lines are processed when you have defined restart points, or whether to write data lines in uppercase or lowercase letters.

Restarting executable objects

The generation mode in a :GENERATE statement controls how script lines are handled during script execution when an executable object is restarted. The generation mode you define is valid until one of the following statements is processed:

  • the next :GENERATE statement containing one of the three generation modes
  • the next :RESTART statement

When you restart an object without using a :GENERATE statement, then all script lines until the first :RESTART statement are processed, as well as all lines that are located after the indicated restart point.

Uppercase and lowercase characters

With the exception of script variables, text in data lines is generally left untouched and transferred to the target system as is. Variables are supplied with values (in modified form) with the activation of an object that contains such a script. For more information, see Data Lines and Job Control Language.

Some target systems require data lines to be formatted a particular way. For example, the BS2000 operating system only processes Job Control Language (JCL) statements that are written in upper case characters. Commands for this target system must be formatted in the Automation Engine. Use the :GENERATE statement and its generation modes to address the restrictions of specific target systems when writing scripts.

Syntax

:GEN[ERATE] generation mode

Parameters

  • :GENERATE
    Determines how script lines are processed during execution

  • generation mode
    Parameters for processing of script lines
    Allowed values for restarts:

    • ON_RESTART_ALWAYS
      Script lines are always processed, regardless of the restart point
    • ON_RESTART_CHECK
      Script lines are not processed when they are located before the restart point
    • ON_RESTART_NEVER
      Script lines are never processed, regardless of the restart point
    Allowed values for data lines:
    • UPPER_CASE
      Converts the text in all DATA lines to uppercase letters
    • LOWER_CASE
      Converts the text in all DATA lines to lowercase letters
    • CASE_UNCHANGED
      Restores the initial condition of the text (uppercase and lowercase letters)

Examples

In the following example, :RESTART statements define 3 restart points. :GENERATE statements with different generation modes define which script lines are processed when the object is restarted:

:PRINT "Script start"

:
RESTART R1
:
PRINT "Point R1"

:
GENERATE ON_RESTART_ALWAYS
:
PRINT "ON_RESTART_ALWAYS"

:
GENERATE ON_RESTART_CHECK
:
RESTART R2
:
PRINT "Point R2"
:
RESTART R3
:
PRINT "Point R3"

:
GENERATE ON_RESTART_NEVER
:
PRINT "Script end"

When the object restarts at restart point R1, the following lines are printed in the activation report:

2005-01-31 12:17:05 - U0020408 Script start
2005-01-31 12:17:05 - U0020408 Point R1
2005-01-31 12:17:05 - U0020408 ON_RESTART_ALWAYS
2005-01-31 12:17:05 - U0020408 Point R2
2005-01-31 12:17:05 - U0020408 Point R3

When the object restarts at restart point R2, the following lines are printed in the activation report:

2005-01-31 12:17:23 - U0020408 Script start
2005-01-31 12:17:23 - U0020408 ON_RESTART_ALWAYS
2005-01-31 12:17:23 - U0020408 Point R2
2005-01-31 12:17:23 - U0020408 Point R3

When the object restarts at restart point R3, the following lines are printed in the activation report:

2005-01-31 12:17:48 - U0020408 Script start
2005-01-31 12:17:48 - U0020408 ON_RESTART_ALWAYS
2005-01-31 12:17:48 - U0020408 Point R3

In the following example, the :GENERATE statement converts text in a data line to upper case letters:

:GEN UPPER_CASE
fs $AE.

See also: