UniBasic Commands Reference - Rocket Software

UniBasic Commands Reference - Rocket Software UniBasic Commands Reference - Rocket Software

rocketsoftware.com
from rocketsoftware.com More from this publisher
11.04.2013 Views

Options The value of option determines the operation to be executed. The following table describes these options and their results. Value Description Examples In the following example, the program segment inserts AR in the string ASTATES. After execution, ASTATES contains the string “AL:AK:AR:AZ”. 1-250 UniBasic Commands Reference If option > 0 UniData replaces the number of substrings specified in option. If option = 0 UniData inserts new.expr at the position indicated by b.pos. If option < 0 UniData deletes the number of substrings specified in option, and inserts new.expr at the location indicated by b.pos. FIELDSTORE Options ASTATES = 'AL:AK:AZ' ASTATES = FIELDSTORE(ASTATES,':',3,0,'AR') The following program segment compiles and runs only when null value handling is on. The program segment inserts AR, and then inserts the null value into ASTATES. It calls the externally cataloged subroutine PRINT.SETUP to convert the null value to a printing character, and then prints the converted ASTATES. (PRINT.SETUP is shown under CHANGE.) PRT.STR = '' ASTATES = 'AL:AK:AZ' ASTATES = FIELDSTORE(ASTATES,':',3,0,'AR') PRINT "ASTATES = ":ASTATES ASTATES = FIELDSTORE(ASTATES,':',3,0,@NULL) STR = ASTATES CALL PRINT.SETUP(STR,PRT.STR) PRINT "ASTATES = ":PRT.STR This program prints the following: ASTATES = AL:AK:AR:AZ ASTATES = AL:AK:@NULL:AR:AZ

In the next example, the program segment specifies that processing begins at the fifth value (ugly), that this value is deleted (the -1 option), and that the new.expr (orange,black) is to be inserted in the same position. After processing, COLORS contains the string “yellow,blue,red,green,orange, black,white”. COLORS = 'yellow,blue,red,green,ugly,white' COLORS = FIELDSTORE(COLORS,',',5,-1,'orange,black') Related Commands UniBasic INS, INSERT FIELDSTORE 1-251

In the next example, the program segment specifies that processing begins at the fifth<br />

value (ugly), that this value is deleted (the -1 option), and that the new.expr<br />

(orange,black) is to be inserted in the same position. After processing, COLORS<br />

contains the string “yellow,blue,red,green,orange, black,white”.<br />

COLORS = 'yellow,blue,red,green,ugly,white'<br />

COLORS = FIELDSTORE(COLORS,',',5,-1,'orange,black')<br />

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

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

INS, INSERT<br />

FIELDSTORE 1-251

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

Saved successfully!

Ooh no, something went wrong!