Bom

rmdasari

Member
Hi All :

I had created 2 temp-tables, one with items to be deleted and their components. The other table excluding the items to be deleted. I wanted to do a find on the 2nd table by picking the 1st component on the 1st table and if that item is not used in any other parts then mark the deletion field as 'yes'.

Ex. Item A has components C, D & E
The 1st table has 3 records as A - C, A - D & A - E

As stated earlier the 2nd table and 10 records excluding item "A".

Now I wanted to search for component "C" in the 2nd table and if its not found anywhere then update "C" as "Yes" (to be deleted).

The following code is not working and would appreciate if someone could find out as what I am doing wrong.

for each bar_tbl :
find mstr_wrk where mcomp = bcomp no-lock no-error.
if not avail mstr_wrk then
bdel = yes.
end.
end.


Thanks in advance for all the help.


Ramamurthy Dasari
 

LarryD

Active Member
Is component "C" in the 2nd table more than once?

If so, the find mstr_wrk you have would be "ambiguous" (more than 1 occurrence) and not available.

If what I suspect is true, use

find first mstr_wrk ...

then your if not avail will work.

There are other ways to accomplish this, but using your code that's likely all that needs done if "C" can be there more than once.
 

rmdasari

Member
Larry :

Yes it works. Stupid of me forgetting about that. Thanks for the help.


Thanks & Regards,

Ramamurthy Dasari
 
Top