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.

Examples<br />

The following program segment is taken from the sample program in Appendix A,<br />

“Sample Program,” in Developing <strong>UniBasic</strong> Applications. The variable ENTRY is<br />

used to extract the user-requested values from the ORDERS record.<br />

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

DISPLAY_DATA:<br />

* Display the current information in the desired record. This is<br />

* determined by the number the user entered (ORDER_NUMBER).<br />

...<br />

NUM_ENTRIES = DCOUNT(ORDER.REC,@VM)<br />

FOR ENTRY = 1 TO NUM_ENTRIES<br />

PRODUCT_NUMBER = ORDER.REC<br />

COLOR = ORDER.REC<br />

QUANTITY = ORDER.REC<br />

PRICE = OCONV(ORDER.REC,"MD2$,")<br />

In the following example, the program segment assigns the string Joan to the variable<br />

MID. Joan is the second attribute in the dynamic array ARR. The value and subvalue<br />

expressions are 0, resulting in the extraction of an attribute.<br />

ARR = "#543":@AM:"Joan":@AM:"D’Arc"<br />

MID = EXTRACT(ARR,2,0,0)<br />

In the next example, the program segment assigns the string Dagny, the second value<br />

of the third attribute, to the variable MID:<br />

ARRAY = "#143":@AM:"Gustav":@AM:"Mahler":@VM:"Dagny":@VM:"Jens"<br />

MID = EXTRACT(ARRAY,3,2)<br />

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

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

DEL, INSERT, REMOVE, REPLACE, SUBSTRINGS

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

Saved successfully!

Ooh no, something went wrong!