The Delete Data Base Records command deletes records in a file based
on a value in a single field. The user of the command must have all
rights to the file. OPNQRYF is used internally to select the records
to provide for fast processing. DLTDBFRCD provides a simple cleanup
function.
The user of the command must have all rights to the file.
A typical command would be:
DLTDBFRCD FILE(xxx) SELFLD(AAA) SELVAL(X)
Any records with a value of 'X' in field AAA would be deleted. By
default, '*EQ' is used as the comparison operator. Any of the
operators such as *GE, *NE, etc may be used along with *CT
(contains). An option exists to allow a translation to upper case if
the data base field may contain lower case values.
Only character and decimal fields are supported. Multi-format
logical files are not supported.
If the file is not externally described, use the file name as the
SELFLD name.
DLTDBFRCD escape messages you can monitor for
---------------------------------------------
TAA9896 The field does not exist in the file.
Escape messages from based on functions will be re-sent.
Audit journal entry
-------------------
When DLTDBFRCD is run, the TAA Tool SNDAUDE is used internally to
send a journal entry to the QAUDJRN journal if it exists. The
journal code assigned is U with a type of TA. The first 10 bytes of
the entry will be DLTDBFRCD.
If the journal does not exist, a message is sent to QSYSOPR. This
serves as an audit trail that the command was used to change the
object.
Command parameters *CMD
------------------
FILE The qualified name of the file to delete records
from. The library value defaults to *LIBL. *CURLIB
may also be used.
SELFLD The field name in the file to select on. Only the
types character, packed, zoned, or binary are
supported.
If the file is not externally described, use the
file name as the SELFLD name.
SELVAL The value of the selection field to cause the record
to be deleted.
The special value *BLANKS may be entered (beginning
in position 1) to select on a blank value.
If the selection field is declared as a decimal
type, the value must contain digits and an optional
decimal point. The special value *ZEROS may be
entered (beginning in position 1) to test for zeros
in the selection field.
The value entered is case sensitive. If a field
should be deleted that contains an upper case 'A',
SELVAL(A) should be entered. This will not delete
any fields containing a lower case 'a'.
Conversely, if a field should be deleted that
contains a lower case 'a', SELVAL(A) should be
entered. This will not delete any fields containing
an upper case 'A'.
If the data base has mixed case, see the TRANSLATE
option.
SELOP The operation to be used for selection. The default
is *EQ. The other values that may be specified are
*GE *GT *LE *LT, *NE or *CT (contains). The *CT
function scans the field in the record for the
select value and may only be used on character
fields.
MBR The member to delete records from. The default is
*FIRST for the first member in the file.
TRANSLATE Whether to use the translation table defined by the
TAA Tool RTVTRNTBL to translate to upper case. The
default is *NO. Use the default when the data base
field to select on is decimal.
The SELVAL field value may be entered in either
upper or lower case to match your data base value.
If a match will always occur, use TRANSLATE(*NO)
TRANSLATE(*YES) should be specified when the data
base field contains both lower and upper case
characters. This causes the translation table
defined for the TAA Tool RTVTRNTBL to be used (the
default is QSYSTRNTBL in QSYS) on the OPNQRYF
command. Translation forces the data base field
value to all upper case characters before the
comparison is made.
Restrictions
------------
The maximum number of fields in a file is 998.
Only character and decimal fields are supported for selection.
Multi-format logical files are not supported.
Prerequisites
-------------
The following TAA Tools must be on your system:
EDTVAR Edit variable
HLRMVMSG HLL Remove message
RTVDBFA Retrieve data base file attributes
RTVFLDA Retrieve data base field attributes
RTVTRNTBL Retrieve Translate table
RTVVALA Retrieve CLP variable value attributes
SNDAUDE Send audit entry
SNDCOMPMSG Send completion message
SNDESCMSG Send escape message
Implementation
--------------
None, the tool is ready to use.
Objects used by the tool
------------------------
Object Type Attribute Src member Src file
------ ---- --------- ---------- ----------
DLTDBFRCD *CMD TAADBJE QATTCMD
TAADBJEC *PGM CLP TAADBJEC QATTCL
TAADBJER *PGM RPG TAADBJER QATTRPG
|