Search by Key (SK)

Command title

Search by Key

Description

This command locates a row that has the same key as the one specified in the xxxx-KEY-AREA parameter.

COBOL syntax

MOVE 'SK'                   TO xxxx-COMMAND.
CALL 'TBLBASE' USING        TB-PARM
                            xxxx-COMMAND-AREA
                            xxxx-KEY-AREA.

C syntax

memcpy( tbCommArea.tbCommand, "SK", 2 );
TBLBASE( &tbParm, &tbCommArea, pKeyArea );

Parameters

xxxx-KEY-AREA

Explanation

If the row is found, COUNT is set to the subscript of the found row. The SK command does not retrieve a row from the table; a subsequent FETCH BY COUNT command will retrieve the new COUNT value set by SK.

Return value

If the row is found, FOUND is set to Y and COUNT is set to the subscript of the found row. If the requested row is not found in the table, FOUND is set to N and the COUNT will contain the appropriate subscript for a potential insertion.

Notes

Ideal for validation applications

Exceptions

None

See also

3. FOUND (1 byte)

8. COUNT (fullword binary)