I am trying to use BTREE.EXTRACT to get more than 64k worth of keys and have been unable to. I have OI 3.6.1. I created the following bit of code to test it out.
Open 'DICT.PAYABLE' to dict Thensearch=PAYEE_CODE' :@VM: 'B*2' :@FMfile =PAYABLE'keys ='opt =S'opt=1opt='flag ='Call BTREE.EXTRACT(search, file, dict, keys, opt, flag)length =LEN(keys)num_keys=COUNT(keys, @VM) + (keys # '')DEBUGEnd Elsemesg=|Unable to open the DICT.PAYABLE table.|'Call MSG(mesg)EndWhen I get to the debug num_keys is set to 12507, even though I have 12512 records that meet the selection criteria, flag is set to zero and opt is unchanged.
Does BTREE.EXTRACT not work for more than 64k worth of keys or is there something wrong with my test routine?
When Btree.Extract returns the keys to the specified variable, that variable cannot exceed the 64k LIMIT. If it does, you will get an error specifying the variable has exceeded maximum length. It has nothing to do with Btree.Extract.
Bro
I know that the variable can only contain 64k worth of keys but I was under the impression that if more than 64k worth of keys existed then the variable FLAG would be gretaer than zero and you could then put BTREE.EXTRACT in a loop, checking this variable each time. Something like this.
LoopCall BREE.EXTRACT(search, file, dict, keys, option, flag)While flag ] 0Gosub PROCESS_KEYSRepeatIf flag=0 Then Gosub PROCESS_KEYSMy problem is that when I call BTREE.EXTRACT, flag is set to zero, even when I know I have more than 64k worth of keys that meet the selection criteria.
Uou have to explisitly tell OI/AREV that you want more than 64K by setting a parameter - I think it is flag to -1 or somesuch….
World Leaders in all things RevSoft
I tried setting the flag variable to -1 and that made no difference. The manual does say to set field 2 of the options parameter to one though, which I have already tried.
The AREV Developer Series manual says:
"The list of keys is limited to 64k and will be truncated if longer. If the list is truncated, an appropriate error code is returned in the flag argument".
I would be surprised if OI's BTREE.EXTRACT routine is any different. Bad luck. Looks like you will have to use REDUCE..SELECT BY or the RLIST SELECT for your answers.