11.04.2013 Views

UniBasic Commands Reference - Rocket Software

UniBasic Commands Reference - Rocket Software

UniBasic Commands Reference - Rocket Software

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

In some implementations, the values are different:<br />

AB 3 2<br />

CD 6 2<br />

EF 8 2<br />

In the next example, the program segment compares processing time for the<br />

REMOVE statement versus the EXTRACT statement:<br />

1-678 <strong>UniBasic</strong> <strong>Commands</strong> <strong>Reference</strong><br />

MAINLINE<br />

OPEN ' ', 'VOC' TO VOC ELSE STOP 'CANNOT OPEN VOC FILE!'<br />

READ ITEM FROM VOC, 'BIGTEST' THEN<br />

LINE.CNT = DCOUNT (ITEM, @AM)<br />

PRINT "Bigtest in file VOC: "; LINE.CNT: " lines, ":<br />

PRINT LEN(ITEM): "bytes."<br />

GOSUB TIME.EXTRACT<br />

GOSUM TIME.REMOVE<br />

END ELSE<br />

PRINT 'COULD NOT READ ITEM BIGTEST'<br />

END<br />

STOP<br />

TIME.EXTRACT:<br />

LINE.IDX = 1<br />

START.TIME = TIME()<br />

LOOP<br />

UNTIL LINE.IDX LINE.CNT DO<br />

LINE = ITEM<br />

LINE.IDX += 1<br />

REPEAT<br />

END.TIME = TIME()<br />

PRINT "EXTRACT: ": OCONV(END.TIME-START.TIME, 'MTS'):<br />

RETURN<br />

TIME.REMOVE<br />

START.TIME = TIME()<br />

LOOP<br />

REMOVE LINE FROM ITEM SETTING MORE.LINES<br />

WHILE MORE.LINES DO<br />

REPEAT END.TIME = TIME()<br />

PRINT "REMOVE: ": OCONV(END.TIME-START.TIME, 'MTS'):<br />

RETURN<br />

This results in the following:<br />

Bigtest in file VOC: 6000 lines, 59999 bytes.<br />

Processing time:<br />

EXTRACT: 00:07:26<br />

REMOVE: 00:00:03

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!