Aber mit READPE/READE kannst du ja auf Schlüssel abfragen und dann %found auswerten.
Ich habe mir abgewöhnt, den Status nach SETLL/SETGT abzufragen.

Einfach:
setgt (k1:k2:k3) myfile;
reade (k1:k2) myfile;
if %found() = *on;
In dem Beispiel bezieht sich allerdings %Found nicht auf den READE, sondern auf SETGT.

Die Lesebefehle (READ, READE, READP, READPE und READC) können nur mit %EOF abgefragt werden. %Found wird von diesen Befehlen nicht gesetzt.

Der %Found in dem obigen Beispiel bezieht sich auf den Befehl, der den letzten %Found gesetzt hat, also auf den SETGT. Das Ganze wird umso gefährlicher, da noch nichteinmal eine Datei angegeben wurde.

Wenn Du bislang mit solchen Abfragen noch nie Probleme hattest, hattest Du einfach Glück.

Korrekt wäre:
PHP-Code:
 /Free
   SetGT 
(Key1Key2: *HiValMyFile;
   
ReadPE (Key1Key2MyFile
   
If Not %EOF(MyFile);
      
//Satz gefunden
   
EndIf;
 /
End-Free 
Hier noch ein Auszug aus der RPG Referenz:
%FOUND(Return Found Condition)
%FOUND returns ’1’ if the most recent relevant file operation found a record, a string operation found a match, or a search operation found an element. Otherwise, this function returns ’0’.

The operations that set %FOUND are:
File operations:
– “CHAIN (Random Retrieval from a File)” on page 611
– “DELETE (Delete Record)” on page 633
– “SETGT (Set Greater Than)” on page 781
– “SETLL (Set Lower Limit)” on page 785
String operations:
– “CHECK (Check Characters)” on page 614
– “CHECKR (Check Reverse)” on page 617
– “SCAN (Scan String)” on page 776
Note: Built-in function %SCAN does not change the value of %FOUND.

Search operations:
– “LOOKUP (Look Up a Table or Array Element)” on page 689

%EOF(Return End or Beginning of File Condition)
%EOF returns ’1’ if the most recent read operation or write to a subfile ended in an end of file or beginning of file condition; otherwise, it returns ’0’.
The operations that set %EOF are:
“READ (Read a Record)” on page 750
“READC (Read Next Changed Record)” on page 753
“READE (Read Equal Key)” on page 755
“READP (Read Prior Record)” on page 758
“READPE (Read Prior Equal)” on page 760
“WRITE (Create New Records)” on page 821 (subfile only).

The following operations, if successful, set %EOF(filename) off. If the operation is not successful, %EOF(filename) is not changed. %EOF with no parameter is not changed by these operations.
“CHAIN (Random Retrieval from a File)” on page 611
“OPEN (Open File for Processing)” on page 737
“SETGT (Set Greater Than)” on page 781
“SETLL (Set Lower Limit)” on page 785
Birgitta