Example
EXECUTE 'SELECT fileA' RTNLIST varA
EXECUTE 'SELECT fileB WITH XYZ="abc"' RTNLIST varB
What happens *sometimes* is that varA is empty even though fileA
contains many records. The circumstance is always when varB returns
some keys but the code can be run 100 times during the day and will
only fail once. The only difference that I can point to is system
load. It fails at times when there are few users on the system.
What is the sequence of events when EXECUTE is used with RTNLIST? Does
the SELECT create an active select list and EXECUTE copies it to the
variable right at the end? If so, is it possible that the second
EXECUTE is hijacking the active list before the first EXECUTE has
completed?
Thanks
EXECUTE 'SELECT fileA' RTNLIST varA
EXECUTE "CLEARSELECT"
EXECUTE 'SELECT fileB WITH XYZ="abc"' RTNLIST varB
EXECUTE "CLEARSELECT"
I would just like to understand why the CLEARSELECT is needed...
> > > > Thanks- Hide quoted text -
>
> - Show quoted text -
I would think that maybe there's an active select list (in certain
circumstances) that may be causing the first SELECT to return zero items,
because none of the items in the 'active select list' are in fileA - ... but
if that were the case you would typically be seeing a message about Item Z
(Y, A, ...) not being found... unless the code is actually doing CAPTURING
JUNK or something ...
I believe the SYSTEM(11) function will return info on whether there's an
active select list, so you might check it before doing the execute. If a
select list is active, then a CLEARSELECT would be appropriate, but then
again, you might want to figure out why there was such a creature to begin
with? i.e. perhaps some other process didn't finish processing all of its
items.
Generally, RTNLIST clears the active list, so I wouldn't think the
CLEARSELECT would be necessary between these statements anyway; so perhaps
some flavor of Pick/JBase behaves differently in this regard?
Tom
Regards,
Charlie Noah
Inland Truck Parts
I would think not. But, if this code was run while a select was active and that select was with items not in fileA, then you would get exactly what you say your problem is. The CLEARSELECT suggested would eliminate this if it came before the two statements.
CLEARSELECT
EXECUTE 'SELECT fileA' RTNLIST varA
EXECUTE 'SELECT fileB WITH XYZ="abc"' RTNLIST varB
Dan Ell
I'll try out the CLEARSELECT and then start looking for the needle in
the haystack...
Thanks again.
> >> - Show quoted text -- Hide quoted text -