Delete by Count (DC)

Command title

Delete by Count


This command deletes a row from a table and places it in xxxx-ROW-AREA.

COBOL syntax

MOVE 'DC'                   TO xxxx-COMMAND.

C syntax

memcpy( tbCommArea.tbCommand, "DC", 2 );
TBLBASE( &tbParm, &tbCommArea, pRowArea );




This command deletes a row whose subscript is specified in the COUNT field of xxxx-COMMAND-AREA from the table identified by the TABLE field of the xxxx-COMMAND-AREA. The deleted row is moved into xxxx-ROW-AREA for verification.

The ROW-OVERRIDE-LENGTH can be used to indicate how many bytes of the row are moved into xxxx-ROW-AREA.

Return value

The FOUND field is Y if there was no error and the row is found and deleted, otherwise it is set to N.

Error 0006 subcode 1 occurs when the COUNT is zero.

Error 0006 subcode 2 occurs when the COUNT exceeds the number of rows.


DC should be used only when the subscript of the row to be deleted is known, usually through a previous successful FETCH or GET. It may not be used to delete empty Hash table entries.

If Delete by Count is used inappropriately, unintended rows may get deleted causing unpredictable results. If you cannot ensure exclusive access to the table, via a LOCK-LATCH password in a multi-user environment such as CICS, it is preferable to use a Delete by Key command.

In a multi-tasking or multi-user online environment, results for commands that utilize a count or sequential accessing of table rows may get unexpected results if another task/user is updating or deleting rows in the same table.



See also

3. FOUND (1 byte)

8. COUNT (fullword binary)