UniBasic Commands Reference - Rocket Software
UniBasic Commands Reference - Rocket Software UniBasic Commands Reference - Rocket Software
Parameters The following table describes each parameter of the syntax. Paramete r Description INMAT Function Return Values After you execute DIM, the UniBasic INMAT function returns one of the values described in the following table. Resizing Arrays You can use the DIM statement to dynamically redimension an array without losing any data if the size of the redimensioned array is large enough to contain all data in the original array. When you redimension, UniBasic places the old data elements into the new array from left to right and from top to bottom. All leftover data is placed in the 0,0 element. 1-211 UniBasic Commands Reference name1 Specifies the name of the array. rows Specifies the number of rows in the array. ,cols Specifies the number of columns in the array. If cols is omitted, the array is one-dimensional. DIM Parameters Value Description 0 The dimensioned array was not created. UniData returns an error message, but program execution continues. 1 Memory was insufficient to create the dimensioned array. UniData returns an error message, but program execution continues. n The dimensioned array was created. n is the number of elements in the array. INMAT Function Return Values
Although you can change the size of an array during program execution, its configuration cannot change. For example, a two-dimensional array cannot be changed to one-dimensional and vice versa. Examples In the following example, the program statement creates three arrays: one-dimensional NAME, one-dimensional TITLES, and two-dimensional DATES. DIM NAME(100),TITLES(100),DATES(100,2) In the next example, two DIMENSION statements are included in the same program, although because the new array is smaller than the original, all excess data is placed in element 0,0. After the execution of the second DIMENSION statement, the array has the dimension of 100 by 10. DIM WAGES(50,100) DIM WAGES(100,10) The following program segment creates the array TEST by setting variable A to 30, and then declaring TEST as a one-dimensional array of 30 elements: A = 30 DIM TEST (A) The following sample code is invalid because array size is declared with nonnumeric variables “(” and “)” and because you cannot use a variable in a dimension statement: TEST = "(10,5)" DIM TEST In contrast, the following statement is valid: DIM TEST (10,5) Related Commands UniBasic INMAT, MAT, MATBUILD, MATPARSE, MATREAD, MATREADL, MATREADU, MATWRITE, MATWRITEU DIM 1-212
- Page 160 and 161: UniData DELETECOMMON, STACKCOMMON -
- Page 162 and 163: Related Command UniBasic EXIT 1-165
- Page 164 and 165: In the next example, the program se
- Page 166 and 167: In the next example, the program se
- Page 168 and 169: COUNT Syntax COUNT(str.expr1, str.e
- Page 170 and 171: COUNTS Syntax COUNTS(expr,str.expr)
- Page 172 and 173: createCertificate Syntax createCert
- Page 174 and 175: createCertRequest Syntax createCert
- Page 176 and 177: Parameter Description The following
- Page 178 and 179: The following table describes the a
- Page 180 and 181: createSecureRequest Syntax createSe
- Page 182 and 183: Method Description The following ta
- Page 184 and 185: Parameters The following table desc
- Page 186 and 187: DATA Syntax DATA expr1 [,expr2]...
- Page 188 and 189: DBTOXML Syntax DBTOXML(xml_document
- Page 190 and 191: DCOUNT Syntax DCOUNT(str,delim) Des
- Page 192 and 193: DEACTIVATEKEY Syntax DEACTIVATEKEY
- Page 194 and 195: STATUS Code Example The following e
- Page 196 and 197: DEFFUN Syntax DEFFUN function.name
- Page 198 and 199: The preceding program calls the fol
- Page 200 and 201: Examples The following program segm
- Page 202 and 203: Examples The following program stat
- Page 204 and 205: In the next example, the program st
- Page 206 and 207: UniData SQL SELECT - For informatio
- Page 208 and 209: Examples In the following example,
- Page 212 and 213: DIGEST Syntax DIGEST(algorithm, dat
- Page 214 and 215: DIR Syntax DIR(file.expr) Descripti
- Page 216 and 217: STATUS Codes DISABLEDEC has the fol
- Page 218 and 219: DISPLAYWIDTH Syntax DISPLAYWIDTH (s
- Page 220 and 221: DQUOTE DQUOTE is a synonym for the
- Page 222 and 223: Related Commands UniBasic PRECISION
- Page 224 and 225: ECHO Syntax ECHO [ON | OFF | expr]
- Page 226 and 227: EDADRV_CloseStmt Syntax RETCODE EDA
- Page 228 and 229: EDADRV_Connect Syntax RETCODE EDADR
- Page 230 and 231: EDADRV_Disconnect Syntax RETCODE ED
- Page 232 and 233: 1-226 UniBasic Commands Reference
- Page 234 and 235: Return Codes The following table de
- Page 236 and 237: Output Variable The following table
- Page 238 and 239: Output Variables The following tabl
- Page 240 and 241: EDADRV_GetDBInfo Syntax RETCODE EDA
- Page 242 and 243: EDADRV_GetEDAAttr Syntax RETCODE ED
- Page 244 and 245: EDADRV_GetErrmsg Syntax RETCODE EDA
- Page 246 and 247: Input Variables The following table
- Page 248 and 249: EDADRV_LoadSymbols Syntax RETCODE E
- Page 250 and 251: Output Variables The following tabl
- Page 252 and 253: Return Codes The following table de
- Page 254 and 255: Input Variables The following table
- Page 256 and 257: STATUS Codes ENABLEDEC has the foll
- Page 258 and 259: Parameter Description dataLoc 1 - D
Although you can change the size of an array during program execution, its configuration<br />
cannot change. For example, a two-dimensional array cannot be changed to<br />
one-dimensional and vice versa.<br />
Examples<br />
In the following example, the program statement creates three arrays: one-dimensional<br />
NAME, one-dimensional TITLES, and two-dimensional DATES.<br />
DIM NAME(100),TITLES(100),DATES(100,2)<br />
In the next example, two DIMENSION statements are included in the same program,<br />
although because the new array is smaller than the original, all excess data is placed<br />
in element 0,0. After the execution of the second DIMENSION statement, the array<br />
has the dimension of 100 by 10.<br />
DIM WAGES(50,100)<br />
DIM WAGES(100,10)<br />
The following program segment creates the array TEST by setting variable A to 30,<br />
and then declaring TEST as a one-dimensional array of 30 elements:<br />
A = 30<br />
DIM TEST (A)<br />
The following sample code is invalid because array size is declared with nonnumeric<br />
variables “(” and “)” and because you cannot use a variable in a dimension statement:<br />
TEST = "(10,5)"<br />
DIM TEST<br />
In contrast, the following statement is valid:<br />
DIM TEST (10,5)<br />
Related <strong>Commands</strong><br />
<strong>UniBasic</strong><br />
INMAT, MAT, MATBUILD, MATPARSE, MATREAD, MATREADL,<br />
MATREADU, MATWRITE, MATWRITEU<br />
DIM 1-212