COZZI - Delete Records (DLTRCD)

Where allowed to run: All environments (*ALL)
Threadsafe: No
Parameters
Examples
Error messages

The COZZI - Delete Records (DLTRCD) command deletes records from the specified database file member. It uses either an SQL style WHERE clause or a comparison value to a position in the database record.

Top

Parameters

Keyword Description Choices Notes
FILE Database file name Qualified object name Required, Positional 1
Qualifier 1: Database file name Name
Qualifier 2: Library Name, *LIBL, *CURLIB
MBR Member Name, *FIRST Optional, Positional 2
WHERE SQL WHERE Clause for Delete Character value, *NONE Optional, Positional 3
DLTREL Delete Records when Single values: *NONE
Other values: Element list
Optional, Positional 4
Element 1: Character position in record 1-32766
Element 2: Boolean comparison *EQ, *NE, *LT, *LE, *GT, *GE
Element 3: Value Character value
Top

Database file name (FILE)

Specifies the database file whose records are to be deleted.

Top

Member (MBR)

Specifies the name of the member in the database file specified on the FILE parameter whose records are deleted.

*FIRST
The first member in the file is opened for delete processing.
name
Specify the name of member whose records should be deleted.
Top

SQL WHERE Clause for Delete (WHERE)

Specifies an SQL WHERE condition to delete the records. Any valid SQL WHERE clause for the designated file may be specified including but not limited to comparisons, ranges, generic or compound conditions.

*NONE
No SQL WHERE clause is specified. When *NONE is specified, the DLTREL (delete relations) parameter is used to identify the records to be deleted.
character-value
Specify the SQL WHERE clause used to select the records that are deleted. This value is added to an SQL DELETE statement to delete the records that match this criteria. DO NOT INCLUDE THE "WHERE" keyword in this parameter. The command will generate an SQL statement and run that statement for you.

EXEC SQL DELETE FROM LLLL/FFFF WHERE wwwwwwwwwwwwwwwww;

The DELETE statement is generated (as illustrated above) and contains the file's library name (LLLL) the File name (FFFF) and the WHERE keyword.

Top

Delete Records Relationship (DLTREL)

Specifies a position within each database record that is compared to the value specified on this parameter. If that comparison matches, then the record is deleted. For example: DLTREL(1 *EQ 'D') causes records that contain the letter 'D' in position 1 to be deleted. This parameter is ignored if the WHERE parameter is specified.

Single values

*NONE
The DLTREL parameter is ignored. This is required when a WHERE value is specified. When DLTREL(*NONE) is specified, the WHERE parameter must be specified.

Element 1: Character position in record

1-32766
The record position within the file the is compared to the value.

Element 2: Boolean comparison

*EQ, *NE, *GT, *GE, *LT, *LE
A boolean operator used to condition the comparison.

Element 3: Value

character-value
Specify the value that is used to test the position specified. Any valid character or hexadecimal data may be specified. The length of the value specified for this parameter is used as the length of the comparison. Use caution when passing in CL variables as the length needs to be exact. It may be helpful to include the CL %TRIMR(&COMPVALUE) keyword for this element of the DLTREL parameter. (%TRIMR requires IBM i v7r1 or later.)

DCL VAR(&COMPVALUE) TYPE(*CHAR) LEN(10)
CHGVAR VAR(&COMPVALUE) VALUE('D')
DLTRCD FILE(QGPL/MYMASTER) DLTREL(42 *EQ %TRIMR(&compvalue))

Top

Examples

None
Top

Error messages

Unknown
Top