11.04.2013 Views

UniBasic Commands Reference - Rocket Software

UniBasic Commands Reference - Rocket Software

UniBasic Commands Reference - Rocket Software

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

The following program segment opens both the ORDERS file and the dictionary of<br />

the ORDERS file, then reads the compiled virtual attribute into the program variable<br />

GRAND_TOTAL. After prompting for an order number and reading the record, the<br />

virtual attribute is evaluated with the ITYPE function. In this case, it performs a<br />

summation on the value of GRAND_TOTAL in @RECORD. ITYPE does not<br />

invoke the conversion and format functions in the dictionary item.<br />

OPEN 'ORDERS' TO ORDERS.FILE ELSE STOP<br />

OPEN 'DICT','ORDERS' TO DICT.ORDER ELSE STOP<br />

READ GRAND_TOTAL FROM DICT.ORDER,'GRAND_TOTAL' ELSE<br />

PRINT 'DICTIONARY ITEM GRAND_TOTAL NOT FOUND'<br />

STOP<br />

END<br />

LOOP<br />

PRINT 'Enter order number ':<br />

INPUT ORDER.ID<br />

WHILE ORDER.ID DO<br />

@ID = ORDER.ID<br />

READ @RECORD FROM ORDERS.FILE,ORDER.ID ELSE<br />

PRINT 'ORDER NOT FOUND'<br />

@RECORD = ''<br />

END<br />

IF @RECORD THEN<br />

TOT.AMT = ITYPE(GRAND_TOTAL)<br />

TOT.AMT = OCONV(TOT.AMT,'MD2,$')<br />

PRINT "Total accounts receivable is ":TOT.AMT<br />

END<br />

REPEAT<br />

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

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

CALCULATE<br />

UniData<br />

COMPILE.DICT – For information, see the UniData <strong>Commands</strong> <strong>Reference</strong>.<br />

Virtual attributes – For information, see Using UniData.<br />

ITYPE 1-408

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

Saved successfully!

Ooh no, something went wrong!