UniBasic Commands Reference - Rocket Software
UniBasic Commands Reference - Rocket Software UniBasic Commands Reference - Rocket Software
Parameter Description INMAT Function Return Values After you execute MATREAD, the INMAT function returns one of the values described in the following table. Note: BASICTYPEs P and R do not support the 0,0 element. If more attributes are read from the file than can be placed in the dimensioned array, a runtime error results and data is lost. Examples In the following example, the program segment reads the record with ID NAMES from the CUSTFILE, and assigns the elements to the dimensioned array TEST. If the program does not find the record, it assigns the value 0 to the variable FOUND. 1-450 UniBasic Commands Reference ON ERROR statements Specifies statements to execute if the MATREAD statement fails with a fatal error because the file is not open, an I/O error occurs, or UniData cannot find the file. If you do not specify the ON ERROR clause and a fatal error occurs, the program terminates. THEN statements END THEN executes if the read is successful. END is required to terminate multiline THEN statements. ELSE statements END ELSE executes if the read is not successful or the record (or ID) does not exist. END is required to terminate multiline ELSE statements. Value Meaning MATREAD Parameters (continued) n The number of attributes loaded into the array. 0 The array was too small to contain all attributes in the record. The excess data (including delimiters) is placed in the 0,0 element. INMAT Function Return Values DIM TEST(10,10) MATREAD TEST FROM CUSTFILE,"NAMES" ELSE FOUND = 0
In the next example, the program segment reads the record with ID NAMES and assigns the data from the record to the dimensioned array TEST: OPEN "CUSTFILE" TO CF ELSE STOP "NO CUSTFILE" MATREAD TEST FROM CF,"NAMES" ELSE FOUND = 0 In the next example, the MATREAD statement includes multiline THEN and ELSE clauses: FILE.ERR = 0 DIM CUST.ITEM(22) MATREAD CUST.ITEM FROM CUST.FILE,CUST.ID THEN GOSUB PROCESS.CUSTOMER: END ELSE MAT CUST.ITEM = " FILE.ERR = 1 END Related Commands UniBasic DIM, INMAT, MAT, MATBUILD, MATPARSE, MATREADL, MATREADU, MATWRITE, MATWRITEU MATREAD 1-451
- Page 440 and 441: INT Syntax INT(num.expr) Descriptio
- Page 442 and 443: ISNV Syntax ISNV(expr) Description
- Page 444 and 445: ISNVS Syntax ISNVS(dynamic.array) D
- Page 446 and 447: ITYPE Syntax ITYPE(itype.expr) Desc
- Page 448 and 449: LE Syntax expr1 LE expr2 Synonyms #
- Page 450 and 451: LEN Syntax LEN(str.expr) Descriptio
- Page 452 and 453: LENS Syntax LENS(dyn.array) Descrip
- Page 454 and 455: LISTUSER Syntax LISTUSER() Descript
- Page 456 and 457: LN Syntax LN(num.expr) Description
- Page 458 and 459: The following table describes the s
- Page 460 and 461: Parameters The following table desc
- Page 462 and 463: LOCATE in BASICTYPEs U, P, and M Th
- Page 464 and 465: However, in the following array, th
- Page 466 and 467: Parameters The following table desc
- Page 468 and 469: LOOP/REPEAT Syntax LOOP [statements
- Page 470 and 471: Examples The following example is t
- Page 472 and 473: LOWER Syntax LOWER(dyn.array.expr)
- Page 474 and 475: Related Command UniBasic LTS 1-434
- Page 476 and 477: MAT Syntax MAT dim.array = expr MAT
- Page 478 and 479: the values assigned to FEE1 would b
- Page 480 and 481: Parameter Description Examples In t
- Page 482 and 483: MATCH Syntax var MATCH "[~] len [X,
- Page 484 and 485: MATCHFIELD Syntax MATCHFIELD(str.ex
- Page 486 and 487: MATPARSE Syntax MATPARSE dim.array
- Page 488 and 489: The preceding program segment produ
- Page 492 and 493: MATREADL Syntax MATREADL dim.array
- Page 494 and 495: Example In the following example, t
- Page 496 and 497: Parameters The following table desc
- Page 498 and 499: Related Commands UniBasic DIM, INMA
- Page 500 and 501: Parameter Description STATUS Functi
- Page 502 and 503: MATWRITEU Syntax MATWRITEU dim.arra
- Page 504 and 505: MAXIMUM Syntax MAXIMUM(dyn.array.va
- Page 506 and 507: MDPERFORM Syntax MDPERFORM str.expr
- Page 508 and 509: Parameter Description Examples In t
- Page 510 and 511: MINIMUM Syntax MINIMUM(dyn.array.va
- Page 512 and 513: NE Syntax expr1 NE expr2 Synonyms #
- Page 514 and 515: NEG Syntax NEG(expr) Description Th
- Page 516 and 517: NFAUSER Syntax NFAUSER(“username
- Page 518 and 519: DCOUNT INDEX LEN SEQ SWAP 1-480
- Page 520 and 521: NOTS Syntax NOTS(dyn.array) Descrip
- Page 522 and 523: NUM Syntax NUM(expr) Description Th
- Page 524 and 525: NUMS Syntax NUMS(dyn.array) Descrip
- Page 526 and 527: OCONV Syntax OCONV(expr, conv.code.
- Page 528 and 529: OCONV Date (D) Syntax OCONV(integer
- Page 530 and 531: Note: Following SMA standards, Mond
- Page 532 and 533: Related Commands UniBasic DATE, ICO
- Page 534 and 535: Related Command UniBasic ICONV Grou
- Page 536 and 537: Related Command UniBasic ICONV Leng
- Page 538 and 539: Parameter Description Examples The
Parameter Description<br />
INMAT Function Return Values<br />
After you execute MATREAD, the INMAT function returns one of the values<br />
described in the following table.<br />
Note: BASICTYPEs P and R do not support the 0,0 element. If more attributes are<br />
read from the file than can be placed in the dimensioned array, a runtime error results<br />
and data is lost.<br />
Examples<br />
In the following example, the program segment reads the record with ID NAMES<br />
from the CUSTFILE, and assigns the elements to the dimensioned array TEST. If the<br />
program does not find the record, it assigns the value 0 to the variable FOUND.<br />
1-450 <strong>UniBasic</strong> <strong>Commands</strong> <strong>Reference</strong><br />
ON ERROR statements Specifies statements to execute if the MATREAD statement fails<br />
with a fatal error because the file is not open, an I/O error occurs,<br />
or UniData cannot find the file.<br />
If you do not specify the ON ERROR clause and a fatal error<br />
occurs, the program terminates.<br />
THEN statements END THEN executes if the read is successful. END is required to<br />
terminate multiline THEN statements.<br />
ELSE statements END ELSE executes if the read is not successful or the record (or ID)<br />
does not exist. END is required to terminate multiline ELSE<br />
statements.<br />
Value Meaning<br />
MATREAD Parameters (continued)<br />
n The number of attributes loaded into the array.<br />
0 The array was too small to contain all attributes in the record. The excess data<br />
(including delimiters) is placed in the 0,0 element.<br />
INMAT Function Return Values<br />
DIM TEST(10,10)<br />
MATREAD TEST FROM CUSTFILE,"NAMES" ELSE FOUND = 0