Automatic SELECT and DELETE
Both the SELECT
and DELETE
commands
require keywords that identify a specific record. In many cases, you
will want to SELECT
or DELETE
a
set of records based on various criteria, rather than individually
create a statement for each record.
The LIST
statement can identify sets of
records and can be used to automatically generate and execute SELECT
and DELETE
statements
for each record found by adding SELECT
and DELETE
keywords
to the LIST
statement.
For example, LIST ADCOM ADID(ABC*) VALID(=) SELECT(Y)
generates
and executes SELECT
statements for each application
definition beginning with ABC
that is valid the day
of execution.
The SELECT
keyword can have values Y
or N
.
If Y
is set, every application found by the LIST
statement
will also be subsequently have a SELECT
command
executed for it. If SELECT
is not specified
as a keyword N
is assumed.
SELECT
with LIST
CPOPCOM
, you can also specify OP,JS,USRF
and ALL
(for
details, see LIST CPOPCOM – Current Plan Operation).It is recommended that the DELETE
keyword
is used in conjunction with the SELECT
keyword
so the record is selected before it is deleted. This gives the opportunity
for batch loader to be generated for each object before it is deleted,
assuming the relevant OUTPUT statements are in play. It is recommended
that FILESPEC=EQQFLALL
is used to ensure that
it is possible to recover the deleted records.
For example, LIST ADCOM ADID(ABC*) VALID(=) SELECT(Y)
DELETE(Y)
generates and executes SELECT
and DELETE
statements
for each application definition beginning with ABC
that
is valid the day of execution.
The DELETE
keyword can have values Y
, N
or D
.
If Y
is set, every application found by the LIST
statement
will also be subsequently have a DELETE
command
executed for it. If D
is set, then deletion
of every application is deferred. This results in DELETE
statements
being generated for each object and written to an output file for
later execution (see OPTIONS DELFILE
). If DELETE
is
not specified as a keyword N
is assumed.
The SELECT
and DELETE
statements
executed by this method are set to message level 2. This means that
by default you will not see these statements in the job output, unless
they fail. To see these statements even if they are successful set OPTIONS
MSGLEVEL(2)
.
Defaults for the LIST SELECT
and LIST
DELETE
keywords can be set by OPTIONS SELECT
and OPTIONS
DELETE
.