Replace by Count (RC)

Command title

Replace by Count


This command replaces a row that already exists in a table.

COBOL syntax

MOVE 'RC'                   TO xxxx-COMMAND.

C syntax

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




The content of the xxxx-ROW-AREA replaces the indicated row in the table.

Return value

FOUND code is always Y after this operation, unless there is an error.

ERROR 0006 subcodes 1 and 2 indicate that the COUNT specified is out of bounds.

ERROR 0006 subcode 3 indicates you are trying to replace an empty Hash table entry.


No checking of key sequence is performed using this command. Replace by Count should be used only when the subscript of the row to be replaced is known, usually through a previous successful retrieval.

If Replace by Count is used inappropriately, rows may get out of sequence or you may be replacing unrelated rows, causing unpredictable results. If you cannot ensure exclusive access to the table, via a LOCK-LATCH password in a multiuser environment such as CICS, it is preferable to use a Replace 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.


RC may not be used to replace empty Hash table entries.

See also

3. FOUND (1 byte)

8. COUNT (fullword binary)