Kbase P151414: 4GL/ABL: Error (138) executing a FIND with the OF option.
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  31/08/2009 |
|
Status: Unverified
SYMPTOM(s):
4GL/ABL: Error (138) executing a FIND with the OF option.
** <file-name> record not on file. (138)
Executing the following code snippet:
DEFINE TEMP-TABLE tt-eid_type
FIELD eid_type LIKE eid.eid_type
INDEX eid_type IS UNIQUE PRIMARY
eid_type.
CREATE tt-eid_type.
tt-eid_type.eid_type = 1.
FIND eid WHERE eid.eid = 14001.
MESSAGE "eid.eid_type:~t" eid.eid_type
VIEW-AS ALERT-BOX INFO BUTTONS OK.
FIND tt-eid_type OF eid.
MESSAGE "tt-eid_type.eid_type:~t" tt-eid_type.eid_type
VIEW-AS ALERT-BOX INFO BUTTONS OK.
FACT(s) (Environment):
All Supported Operating Systems
OpenEdge 10.1C
Executing the same find without the OF option finds the record as expected:
DEFINE TEMP-TABLE tt-eid_type
FIELD eid_type LIKE eid.eid_type
INDEX eid_type IS UNIQUE PRIMARY
eid_type.
CREATE tt-eid_type.
tt-eid_type.eid_type = 1.
FIND eid WHERE eid.eid = 14001.
MESSAGE "eid.eid_type:~t" eid.eid_type
VIEW-AS ALERT-BOX INFO BUTTONS OK.
FIND tt-eid_type WHERE tt-eid_type.eid_type = eid.eid_type.
MESSAGE "tt-eid_type.eid_type:~t" tt-eid_type.eid_type
VIEW-AS ALERT-BOX INFO BUTTONS OK.
CAUSE:
The OF facility looks for any match on an indexed field in the "OF" table where the lead field name "matches" or "partially matches" with some indexed field in the other table.
So it starts off with EID in the eid table, and looks for anything matching that in the other table. It immediately finds the only index there which is on EID_Type, an initial subset match, and uses it. This is not what is wanted, but it follows the rules.
FIX:
Use the WHERE clause to explicitly specify the related fields or ensure that there is no possible ambiguity that would be caused by having unrelated fields start their names with the same substring.