When trying to find the key in IMS DBD, the browse session does not work correctly with the LOCATE KEY command.
search cancel

When trying to find the key in IMS DBD, the browse session does not work correctly with the LOCATE KEY command.

book

Article ID: 395355

calendar_today

Updated On:

Products

File Master Plus for IMS

Issue/Introduction

Try to find the key in IMS DBD that has a key value length of 8 bytes, but when using LOCATE KEY with a key value of 12345, the result is an exact key not found message.
But instead of the LOCATE command, use the FIND command, as FIND 123345 finds the value.

Environment

Z/OS

Cause

If the key segment length is larger than the actual key value, then specify the entire length of the key segment field.

Resolution

If key segment field lengths are 8 bytes long but the actual value length is only 5 bytes, then use the LOCATE command as follows:
Instead of using LOCATE KEY 12345, change it to LOCATE KEY '12345 ' <<< After 5 bytes of actual value, add 3 spaces to make up the entire key length.

Additional Information

Jumps directly to a segment.
 
Syntax:
LOCATE     lnum |label  | {key_value} KEY| kwd_value [FIRST|LAST|NEXT|PREV]
 
Syntax Description:
 
lnum
Specifies the line of the segment relative to the beginning of the current display.
label
Specifies a previously defined label.
Note
For more information about labels, see Using ISPF.
key_value
Specifies the root segment key value.
key
When a key_value is provided, it jumps to the root segment whose key value is GTEQ key_value. This is only valid for keyed databases.
When key_value is omitted, the current segment’s concatenated key is displayed on the Locate Key panel. This key can be updated with the concatenated key value of the segment you want to position to.
kwd _value
Specifies one of the following commands to jump to the next segment within the line attribute:
* CHANGE
* COMMAND
* ERROR
* SPECIAL (BNDS, COLS, MASK)
FIRST
With 'kwd_value' jumps to the first segment with the requested attribute.
LAST
With 'kwd_value' jumps to the last segment with requested attribute.
NEXT
With 'kwd_value' jumps to the next segment with the requested attribute.
PREV
With 'kwd_value' jumps to the previous segment with the requested attribute.
 
Alias: L, LOC