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 'DK1TCALL' USING        TB-PARM
                            xxxx-COMMAND-AREA
                            xxxx-KEY-AREA.

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.

The table must be open for write in the TSR or VTS-TSR. Multiple error codes can be returned by this command.

Notes

Ideal for validation applications

Exceptions

None

See also

3. FOUND (1 byte)

8. COUNT (fullword binary)

Fetch by Count (FC)