KEY


The KEY command is used to change the position in a database from the current segment position to any other segment position.

If you enter the KEY command without a SEGMENT-NAME operand, the Key Specification screen is displayed based on your current hierarchical path and segment position. For example, if your current segment type is at the third level of the database, the Key Specification screen enables you to specify any key value for each segment type in the hierarchical path to that current segment type.

When you use the SEGMENT-NAME operand with the KEY command, the segment name you enter must be one that is defined in the primary DBD you entered on the Database Specification screen. The Key Specification screen displayed is based on the current hierarchical path and the position of the segment whose name you entered within the database hierarchy.

For example, assume your current segment type is on the second hierarchical level of a database and you enter the KEY command with the name of a segment type that is on the fourth hierarchical level. Although the current hierarchical path extends only as far as the second level in the database, the Key Specification screen enables you to specify key values down to and including the specified segment type on the fourth level.

See here for a more detailed explanation and examples of how to use the Key Specification screen.

When you complete the Key Specification screen for the new segment you want, the segment is retrieved from the database and you are returned to the editing mode from which you entered the KEY command. The new segment becomes the current segment position.

The KEY command is not supported when you browse an HSAM or SHSAM database.

Usage of the KEY command will cause any changes you made to currently displayed segments to be immediately written to the database. These changes can not be reversed by use of the CANCEL command.

image2021-8-12_12-43-44.png

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*