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.

The following program demonstrates the use of SETINDEX to set the record pointer<br />

to the first non-null key in the PROD_NAME alternate key index by specifying rop<br />

operator FIRST_ALT_KEY:<br />

OPEN 'INVENTORY' TO inventory ELSE PRINT "Open error"<br />

SETINDEX 'PROD_NAME', FIRST_ALT_KEY inventory<br />

FOR X = 1 TO 5<br />

READFWD rec FROM inventory THEN<br />

PRINT rec:", ":rec:", ":rec<br />

END ELSE NULL<br />

NEXT X<br />

STOP<br />

Next, run this program using the INVENTORY file that you modified to contain null<br />

values in the PROD_NAME attribute for records 10015 and 10238. The following<br />

output results.<br />

:RUN BP set.idx<br />

10020, Adapter, A/C Adapter for notebook computers<br />

10086, Adapter, Ethernet LC Card<br />

10092, Adapter, Workgroup Hub<br />

10082, CD Player, Portable Model<br />

10104, CD Player, Personal Model, Bass Boost<br />

Tip: You would obtain this same output if the INVENTORY file contained no null<br />

values in PROD_NAME and you specified rop NULLVAL_ALT_KEY.<br />

Related <strong>Commands</strong><br />

<strong>UniBasic</strong><br />

READBCK, READBCKL, READBCKU, READFWD, READFWDL,<br />

READFWDU, READXBCK, READXFWD, SELECTINDEX<br />

UniData<br />

BUILD.INDEX, CREATE.INDEX – For information, see the UniData <strong>Commands</strong><br />

<strong>Reference</strong>.<br />

SETINDEX 1-729

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

Saved successfully!

Ooh no, something went wrong!