Kevin,
Birgitta is correct, but our code has hundreds of examples of %Found doing this same type of thing just fine. For us, %Equal is usually used in a SETLL situation.
You really don't give enough information to draw exact conclusions. So I'm going to make assumptions, and show an example I think fits your issue.
Assuming your file IDCASE10 is keyed and there are 3 fields in the key. Attributes and names are unknown, and the record format is also unknown. The declare should look like this, and I'm stepping it up a bit with a key list for the chain that is a data structure modeled on the file key list. We as a rule code the record format as the I/O for single record format files, and the file name in the "test" for success. See what you think of this:
Dcl-f IDCASE10 keyed;
Dcl-ds CseKey LikeRec(IDCASEREC: *Key) inz;
// real record format unknown...
Clear CseKey;
IDWHSE = LdWhse;
IDCASN = WACASN;
// real key field names of record format unknown...
Chain(n) %Kds(CseKey) IDCASEREC;
1b If Not %Found(IDCASE10);
WSMSG = 'Pallet does not exist in IDCASE10';
Flg_Error = 'Y';
LV LeaveSr;
1e Endif;
All ambiguity removed, very clean, and things line up easily. There are other techniques you can use to tighten this up as well, we often use a data structure over the display that can move many fields into other data structures like the key data structure with the EVAL-CORR op-code, as long as names line up.
------------------------------
Mike Overlander
------------------------------
Original Message:
Sent: Fri October 06, 2023 06:11 AM
From: Kevin Steve
Subject: Chaining a value
Hi,
I am trying to chain a value and display it as per below condition but despite the value exists in this file i get wrong result any idea why is it happening , already checked my lib. list,data using sql and through debug mode nothing worked yet.
[code]
// Check if it's a valid pallet (exists in FILE1)
Chain(N) (LdWhse:' ':WSCASN) FILE1;
CR01 // Chain(N) (%TRIM(WSCASN)) FILE1;
If Not %Found(IDCASE10);
WsMsg = 'Pallet does not exist in FILE1';
Flg_Error = 'Y';
SR01 LeaveSr;
EndIf;
[/code]
Note i tried both the ways like above first by this chain condition :-1)Chain(N) (LdWhse:' ':WSCASN) FILE1;
2nd by this condition :- CR01 // Chain(N) (%TRIM(WSCASN)) FILE1;
i have a field WSCASN defined in my display file let's say 'D1' where this field is defined as 20 A and same definition inside for File1 only it's name is IDCASN in this file for example when i tested this code for key value '305446C003871A' then though this value does exist in IDCASN field of file1 and debug mode also i can see it's assigned to this WSCASN through display file screen still above program code displays wrongly as ''Pallet does not exist in FILE1';
Could someone please advise why is it happening ?
Thanks much...
------------------------------
Kevin Steve
------------------------------