Sign up on the Revelation Software website to have access to the most current content, and to be able to ask questions and get answers from the Revelation community

At 04 FEB 1998 05:19:33AM Dom Glennon wrote:

I'm having difficulty getting V119 to merge the external sort file and then read the results in. When I read the results (using Function code 'V' in a loop), they are in sorted blocks just as if the merge call never had any effect. Also, it reads in far more (at least twice as much) as I wrote. The sort record contains a word and three numbers, all of which are sorted on, plus a string of characters (which may contain \00\) as satellite data. The file is empty at the start of the operation.

Here's the basic code (somewhat simplified):

V119("I", SORT.FILE$, "", "", "", Flag)

IF Flag ELSE Debug

Bys=AAAA"

Justs=LRRR"

LOOP

 GOSUB CREATE_SORTBLOCK

WHILE LEN(SortBlock)

  • Remove trailing @RM
 SortBlock-1,1="
  • Sort and write to C:\SORT.DAT
 V119("S", "", Bys, Justs, SortBlock, "")
 V119("W", SORT.FILE$, "", "", SortBlock, Flag)
 IF Flag ELSE DEBUG
 SortBlock="

REPEAT

IF LEN(SortBlock) THEN

 SortBlock-1,1="
  • Sort remaining data
 V119("S", "", Bys, Justs, SortBlock, "")
  • Write sorted block to DOS file
 V119("W", SORT.FILE$, "", "", SortBlock, Flag)
 IF Flag ELSE DEBUG

END

* Merge sorted block

V119("M", SORT.FILE$, Bys, Justs, "", Flag)

IF Flag ELSE DEBUG

* Read sorted file in in 32K blocks

V119("V", SORT.FILE$, "", "", SortBlock, Flag)

IF Flag ELSE DEBUG

SortBlock-1,1="

BlockLen=LEN(SortBlock)

LastWord="

LOOP

WHILE BlockLen

 SortRec=SortBlockSpos, @RM
 Spos=Col2()+1
 ThisWord=SortRec1, @FM
 ThisPos=SortRecCol2()+1, @FM
 SearchWordNum=SortRecCol2()+1, @FM
 Offset=SortRecCol2()+1, @FM
 CiteInfo=SortRecCol2()+1, @FM
 IF ThisWord # LastWord THEN
    GOSUB PROCESS_WORD
    LastWord=ThisWord
 END ELSE
    GOSUB ADD_TO_STATISTICS
 END
 IF Spos ] BlockLen THEN
  • Read another block
    V119("V", SORT.FILE$, "", "", SortBlock, Flag)
    IF Flag ELSE DEBUG
    SortBlock-1,1="
    Spos=1
    BlockLen=LEN(SortBlock)
 END

REPEAT

Many thanks for your time of you can help me on this one.

Dom Glennon

Cambridge University Press

[email protected]


At 04 FEB 1998 07:13AM Dom Glennon wrote:

It's okay - the problem was in removing the trailing @RM from the sort block before writing to the file.

Dom

View this thread on the forum...

  • third_party_content/community/commentary/forums_nonworks/bf1416a986e72b39852565a10038b8f3.txt
  • Last modified: 2023/12/28 07:40
  • by 127.0.0.1