(800) 219-8613 sales@ashwoodcomputer.com

Using a BASIC Matrix to Improve Performance

[vc_row][vc_column][vc_column_text]Using a dimensioned matrix in basic can be used to increase performance in some applications. The matrix can cache records commonly read from the disk. This works best when you are reading a small number of records over a much larger set of records.

An example is you have 100 stores and you are updating the store records with credit card transactions which number in the thousands or millions. You would cache the store records in the dimensioned matrix and then write them out at the end of the process. The code is written for brevity in the post.

Example:


PROGRAM UPDATE.STORE.CC
DIM STORES(100)
STORE.IDS = "" ;* ATTR 1 = STORE.ID, ATTR 2 = POINTER TO WHERE THE RECORD IS AT IN THE MATRIX
STORE.PTR = 0
*
OPEN '','STORES' TO STOTRES.FV ELSE STOP
OPEN '','CC.TRANS' TO CC.TRANS.FV ELSE STOP
SELECT CC.TRANS.FV
EOF = @FALSE
LOOP
READNEXT CC.TRANS.ID ELSE EOF = @TRUE
UNTIL (EOF) DO
READ CC.TRANS.REC FROM CC.TRANS.FV, CC.TRANS.ID ELSE CONTINUE
STORE.ID = CC.TRANS.REC<1>
LOCATE(STORE.ID,STORE.IDS,1;STORE.POS;"AR") ELSE ;* LOCATE IS FASTER THAN A DISK IO
STORE.PTR = STORE.PTR + 1 ;* MAKE ROOM FOR A NEW STORE RECORD
READ STORES(STORE.PTR) FROM STORES.FV, STORE.ID ELSE CONTINUE ;* READ THE STORE RECORD ONCE
INS STORE.ID BEFORE STORE.IDS<1,STORE.POS> ;* UPDATE ATTR 1
INS STORE.PTR BEFORE STORE.IDS<2,STORE.POS> ;* UPDATE ATTR 2
END
STORE.PTR = STORE.IDS<2,STORE.POS> ;* GET POINTER TO STORE IN MATRIX
STORE.REC = STORES(STORE.PTR) ;* CACHED STORE RECORD
...
REPEAT
* WRITE OUT CACHE TO DISK
FOR I = 1 TO STORE.PTR
STORE.ID = STORES.IDS<1,I>
STORE.PTR = STORES.ID<2,I>
WRITE STORES(STORE.PTR) ON STORES.FV, STORE.ID
NEXT I
STOP
END
[/vc_column_text][/vc_column][/vc_row]



Ashwood Computer, Inc.

Address
10671 Techwoods Circle Cincinnati, Ohio 45242

Telephone
(800) 219-8613
(513) 563-2800

Fax
(513) 554-6412

Our Value – Added

Ashwood Computer, Inc. provides quality products and services that consistently meet our customer’s requirements, while continually searching for ways to improve them.

Our experienced project managers will help you successfully accomplish your goals on time and with optimum results! Our continuing success is attributed to the diverse backgrounds of our technical staff and our overall company drive for Total Customer Satisfaction!

ForeMost ERP is an impressive new ‘Hybrid’ Solution developed utilizing our mvTools.
ForeMost is dramatically improving our customers information systems and business operations. Moreover ForeMost provides our customers a significant competitive advantage!

© 2021 Ashwood Computer, Inc.
Ashwood Computer adheres to ISO 9001:2008 standards, a quality management system recognized around the world for quality design and production.