KEY primary command

The KEY primary command displays the Key Specification panel where you enter key values for segments and thus change the current position in the database.

The Key Specification panel displays key values based on the current hierarchical path and segment position. The panel is initialized with the key values for the segments in the current hierarchical path. You can modify the key values for those segments in the hierarchical path.

After processing of the Key Specification panel is completed, FM/IMS redisplays the IMS Data panel where the KEY command was entered. The segment that satisfies the key values entered on the Key Specification panel becomes the current segment.

Syntax


1 KEY ?segment-name

Availability

segment-name
The name of the segment type that you want to display in the Key Specifications panel. The segment type must be one of the segment types defined in the DBD to be the hierarchical path (parent or child) of the current segment. Alternatively it may be specified as *, which has the same meaning as not specifying it.

If segment name is not specified (or is specified as *), scrolling is restricted to the first hierarchical child segment type under the current segment.

Note:
  1. If FM/IMS doesn't find an exact match for segment-name within the DBD, it searches the list of segments in the DBD to determine if any of the segment names contain the value entered. The first segment name that contains a match is used with the KEY command. For example:
                    ACCOUNTS
                       │
         ┌─────────────┴───────────────────┐
         │                                 │
      BRANCH                            CUSTOMER
                                           │
                                        CUSTADDR

    Entering 'KEY CUST' would display the CUSTOMER segment in the Key Specifications panel but would not find the CUSTADDR segment. However, you could enter 'KEY ADDR' and this would retrieve the next occurrence of the CUSTADDR segment in the database.

  2. If the specified segment occurrence is not found, the current database position is unchanged and the following message is displayed: Invalid segment name