Posted by Robert G Laurin on August 14, 2018 at 12:27:33:
Here's a sample STL Container program that writes 100 Random records to a STL Container and reads it back in order. Remember that there will be duplicate keys, so from 100 expect 60+ records back.
Enjoy!!
! //IB//Src(STL-RND.IBS) Obj(STL-RND,OBJ) Opt(L)!================ Declaratives =================================================
Length 8.0 & Local IND, COUNT
Length 8 & Local KEY$
Length 80 & Local DATA$mySTL: MAP
!================ Executables ==================================================
Clear
Print (0) (CS);(ET)
DO
LET IND = RND(IND) * 100 ! Generate Random Number 0-99
KEY$ = STR(IND)
COUNT = COUNT + 1
DATA$ = STR(IND) + STR(COUNT) ! Data is Key + Order of which is was generated
stlSet(mySTL, KEY$, DATA$) ! Write in Random Order
Loop While COUNT < 100 ! Do it a hundred timesstlBegin(mySTL) ! STL POS=BOF
Let COUNT = 0
Do
DATA$ = stlRead(mySTL) ! Get Data from STL
Let COUNT = COUNT + 1
Print COUNT;':';DATA$
stlNext(mySTL) Excp=Excp.EOF ! Advance STL Pointer Excp=EOF
LoopExcp.EOF:
Print 'End of File, EXCP=';EXCP;' Records:';COUNT
Let COUNT = stlSize(mySTL) ! No of Records in STL
Print 'Size of Container:';COUNT
stlClear(mySTL) ! Clear STL Container
Wait
End
Each file can be a maximum of 1MB in length Uploaded files will be purged from the server on a regular basis.