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

In the next example, the program segment replaces “Blue” with the null value in STG, prints STG, then replaces the null value with “Blue” in STG, and prints STG again. The subroutine PRINT.SETUP converts attribute marks, value marks, and the null value to characters that can be displayed and printed. 1-684 UniBasic Commands Reference STG = "Movies":@AM:"The Sacrifice":@VM:"Blue":@AM:"Rocky IV" STG = REPLACE(STG,2,2,0,@NULL) GOSUB PRINT.SETUP PRINT "STG = ":PRT.STG STG = REPLACE(STG,2,2,0,"Blue") GOSUB PRINT.SETUP PRINT "STG = ":PRT.STG PRINT.SETUP: PRT.STG = CHANGE(STG, @NULL, "@NULL") PRT.STG = CHANGE(PRT.STG, @AM, "@AM") PRT.STG = CHANGE(PRT.STG, @VM, "@VM") RETURN This program prints the following: STG = Movies@AMThe Sacrifice@VM@NULL@AMRocky IV STG = Movies@AMThe Sacrifice@VMBlue@AMRocky IV In the next example, the first REPLACE places Harry Smith in the first attribute position. The second REPLACE places an array with two values in the fifth attribute. CUST.REC ='' CUST.REC = REPLACE(CUST.REC,1,0,01'Harry Smith') CUST.REC = REPLACE(CUST.REC,5,0,0,"V220":@VM:"v230") This results in: CUST.REC = "Harry Smith":@AM::@AM::@AM::@AM:"V220":@VM:"V230" In the following example, the program uses the short form of the REPLACE command to append CLIENT.NAME to NAME.ARRAY1: NAME.ARRAY1 = "Smith Jones Brown" OPEN "CLIENTS" TO CLIENT.FILE ELSE STOP READV CLIENT.NAME FROM CLIENT.FILE,"10034",2 THEN NAME.ARRAY1 = CLIENT.NAME PRINT NAME.ARRAY1 END ELSE PRINT 'NO RECORD FOR CLIENT ':CLIENT.ID END

Related Commands UniBasic DEL, DELETE, EXTRACT, INSERT, REMOVE, REPLACE REPLACE 1-685

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

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

DEL, DELETE, EXTRACT, INSERT, REMOVE, REPLACE<br />

REPLACE 1-685

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

Saved successfully!

Ooh no, something went wrong!