Once a multivalued B-tree has been created, you must remember than every B-TREE-P subroutine call for that B-tree will be using an item ID number concatenated with a multivalue position number. For example, here is a program similar to LIST.NAMES from BTP/Branches #1:
LIST.DATES 001 OPEN "B-TREE" TO BFILE ELSE STOP 002 OPEN "NAMES" TO NFILE ELSE STOP 003 ID = "" ; ITEM = "" 004 CALL BTPFIND("DATES",BFILE,NFILE,ID,ITEM,NODE,POS) 005 LOOP 006 REAL.ID = FIELD(ID,"*",1) 007 VALUE = FIELD(ID,"*",2) 008 READ NAMES FROM NFILE, REAL.ID ELSE NAMES = "" 009 PRINT ; PRINT ID 010 PRINT OCONV(NAMES<7,VALUE>,"D2-") 011 CALL BTPSEQ(BFILE, NODE, POS, "NEXT", ID) 012 UNTIL ID = "" DO REPEAT 013 STOP 014 END
In the above example, BTPFIND is used by LIST.DATES to find the first entry in the B-tree, just like LIST.NAMES did, but the ID argument returned by BTPFIND is an identifier concatenated with a multivalue number, since the B-tree being searched is DATES. That's why FIELD statements are used to separate the identifier and multivalue number before the record is retrieved from the data file and the proper multivalue date is extracted and printed.
BTPSEQ is used to find the next B-tree entry, so that the whole file can be listed in exploded multivalue order. Just like BTPFIND, the ID argument returned by BTPSEQ is a concatenated identifier*multivalue pair, since the B-tree is DATES.