VARGEN – Manage a Generational Data Variable (GDV)
Use the VARGEN
command to create, read, or list the contents of
a Generational Data Variable (GDV).
VARGEN [<varname>)] GDV(<name>)
GEN(<NEW|LIST|n>)
TABLE(<name>)
[LIMIT(n|10)]
[SAVE(YES|NO)]
[VALUE(<value>|@V<input-var-name>)]
<varname>
- Name of the variable into which to load data from a generation of the GDV. This
argument is ignored for
GEN(NEW)
orGEN(LIST)
. GDV(<name>)
- Required. The Generational Data Variable (GDV) to be accessed or created. You can specify from 1 to 7 characters. The same rules valid for the HCL Workload Automation for Z variables apply.
GEN(NEW|LIST|n)
- The generation to access. You can set one of the following values:
NEW
- Creates a new generation by setting the value by either the keyword
VALUE
or@V
keyword. The new generation becomes generation 0 and all previous generations are shuffled downwards, for example 0 becomes -1, -1 becomes -2, and so forth. If the creation of the generations exceeds the maximum limit, the oldest generation is dropped. LIST
- Lists the current values of the GDV.
- n
- Reads a specific generation of the GDV. For example, 0 reads the most recent, -1 reads the generation before 0, and so forth. The positional parameter containing the variable name is required when reading a generation.
TABLE(<name>)
- Required. The table into which the GDV is to be stored. To avoid accidental clash with a non-GDVT, set the table name explicitly, rather than use the table search sequence.
LIMIT(n|10)
- The number of generations that is kept within the GDV. The maximum allowed is 50, the default is 10.
SAVE(YES|NO)
- Whether the GDV is to be stored into a JCL Variable table.Note:
- To set more that one variable in the same table, it is more effective to use a
subsequent
VARSAVE
command than usingSAVE
on everyVARGEN
. - It s not required that a variable already exists within a table. It is added to the table, if needed.
- Tables to not need to exist to have variables saved to them. If a table does not
exist, it is created automatically, using the
OPTIONS OWNER
to set the Owner ID. The description is set to the creating Job name, Jes Number, and current date.
- To set more that one variable in the same table, it is more effective to use a
subsequent
VALUE(<value>)
- Value of a new generation in the GDV.
@V <input-var-name>)
- Another Workload Automation Programming Language
variable to provide the new generation with a value.
Because the content of this keyword is a variable name, you do not need to specify the variable prefix; instead you can use variable names to provide all or part of the name, allowing subscripting to be performed. For example, in the command
@V(@MYOBJ-ADOP-!X-ADOPJN)
the variable!X
sets the segment sequence number in an object variable, allowing all operations to be looped through.
Use the VARGEN
command to create a Generational Data Variable. This
is a special form of variable that allows a history of up to 50 previous values to be stored
and accessed. Like a generation data group (GDG), creating a new entry in a GDV will shuffle
all the old values down a generation. Unlike a GDV, the relative positions are renamed at
once, meaning that when a new generation is created the previous generation 0 becomes
generation -1 and must be referred to as such in all subsequent commands.
The GDV is stored as an HCL Workload Automation for Z dependent variable,
dependent on a variable with the same name as the GDV, with a T prefix. For example, for a GDV
named MYGDV
the independent variable is named
TMYGDV
. This enables you to access a specific generation of the
variable within the HCL Workload Automation for Z JCL. If you access that variable within Workload Automation Programming Language, using the dependency
mechanism, it is considered a normal variable for the course of that Workload Automation Programming Language step, and will not be
accessible with the VARGEN
command.
Use the VARGEN
command also to extract values into normal variables,
and to LIST
the contents of the GDV into the log.
You can save a GDV into a table directly at the time when a new generation is created by
using the VARGEN SAVE
keyword, or you can commit it to a table later
in the process by using the VARSAVE
command.
A GDV does not need to be defined as such, the first time you add a new generation it is created automatically.
Examples
MYGDV
for table
GDVTEST
(but not saved yet). It first adds a generation
containing World
, followed by a new generation containing
Hello
. Hence, generation 0 contains
Hello
and -1 contains World
. As
LIMIT
is not specified, the default 10 is
used:VARGEN GDV(MYGDV) TABLE(GDVTEST) GEN(NEW) VALUE(World)
VARGEN GDV(MYGDV) TABLE(GDVTEST) GEN(NEW) VALUE(Hello)
The output looks like the following
example:EQQI200I VARGEN GDV(MYGDV) TABLE(GDVTEST) GEN(NEW) VALUE(World)
EQQI067A GDV MYGDV in table GDVTEST LIMIT=10 GENS=1
EQQI068A Generation: 0 = World
EQQI299I Statement completed - RC=0
EQQI200I VARGEN GDV(MYGDV) TABLE(GDVTEST) GEN(NEW) VALUE(Hello)
EQQI067A GDV MYGDV in table GDVTEST LIMIT=10 GENS=2
EQQI068A Generation: 0 = Hello
EQQI299I Statement completed - RC=0
MYGDV
:VARGEN GDV(MYGDV) TABLE(GDVTEST) GEN(LIST)
The
output looks like the following
example:EQQI200I VARGEN GDV(MYGDV) TABLE(GDVTEST) GEN(LIST)
EQQI067A GDV MYGDV in table GDVTEST LIMIT=10 GENS=2
EQQI068A Generation: 0 = Hello
EQQI068A Generation: -1 = World
EQQI299I Statement completed - RC=0
MYGDV
in
variable
MYVAR
:VARGEN MYVAR GDV(MYGDV) TABLE(GDVTEST) GEN(-1)
The
output looks like the following
example:EQQI200I VARGEN MYVAR GDV(MYGDV) TABLE(GDVTEST) GEN(-1)
EQQI033A Variable MYVAR set to "World"
EQQI299I Statement completed - RC=0
Accessing a Generational Data Variable through a JCL
//*%OPC SCAN
//*%OPC TABLE NAME=GDVTEST
//*%OPC SETVAR TGDVONE=('-1')
//*%OPC SETVAR TGDVTWO=('-2')
//*GDVONE &GDVONE
//*GDVTWO &GDVTWO
Use SETVAR
to create a temporary variable containing the relative
generation number of the GDV. This must precede the line containing the GDV reference,
though it does not need to immediately precede it. This variable must begin with character
T
and be followed by the name of the GDV. For example, for
GDVONE
the temporary variable must be named
TGDVONE
.
In a JCL, you can reference only one generation of a GDV per job. This can be superseded by maintaining multiple copies of a GDV, so that every time you add a generation you add it to multiple GDVs, as in the following example. In this way, you can access as many generations as the copies of the GDV.
VARGEN GDV(GDVONE) TABLE(GDVTEST) GEN(NEW) VALUE(Hello)
VARGEN GDV(GDVTWO) TABLE(GDVTEST) GEN(NEW) VALUE(Hello)