UniBasic Commands Reference - Rocket Software
UniBasic Commands Reference - Rocket Software UniBasic Commands Reference - Rocket Software
FIND Syntax FIND expr IN dyn.array[,occur] SETTING f [,v[,s]] {THEN statements | ELSE statements} Description The UniBasic FIND command determines the position of the given expression in a dynamic array. FIND returns the attribute, value, and subvalue position of the found string. The expression must match the entire array element to make a match. Parameters The following table describes each parameter of the syntax. Parameter Description 1-260 UniBasic Commands Reference expr Specifies the expression to find. expr must be either a numeric value or a string value. dyn.array Specifies the dynamic array in which to find expr. ,occur Specifies the occurrence of expr to find. The default is 1 (the first occurrence). FIND Parameters
Parameter Description f,v,s Specifies variables in which to place the position of expr: f – Attribute v – Value s – Subvalue If the attribute found has neither multivalues nor subvalues, then v and s, if specified, are set to 0. If only multivalues are present, s is set to 0. If only subvalues exist, v is also set to 0. THEN statements ELSE statements For more information about writing THEN...ELSE parameters, see Developing UniBasic Applications. The UniBasic FIND and LOCATE commands are compared in this manual. Examples Specifies statements to execute if the expr is found in the array. END is required when statements extend over more than one line. Either a THEN statement or an ELSE statement is required. Specifies statements to execute if the expr is not found in the array. END is required when statements are multiline. Either a THEN statement or an ELSE statement is required. FIND Parameters (continued) In the following example, the program segment searches for an occurrence of 31 in the string DA. This results in F=3, V=1, and S=0 because 31 is found in the third attribute as the first multivalue, and this attribute has no subvalues. 001: DA = 1:@AM:2:@AM:31:@VM:32:@VM:41:@VM:41:@VM:42:@VM:43 002: FIND 31 IN DA SETTING F,V,S THEN 003: PRINT "F=":F:" V=":V:" S=":S 004: END ELSE 005: PRINT "NOT FOUND" 006: END In the next example, the program segment searches for the second occurrence of 41 in the string DA. This results in F=3, V=4, and S=0 because the second occurrence of 41 is found in the third attribute as the fourth multivalue, and this attribute has no subvalues. DA = 1:@AM:2:@AM:31:@VM:32:@VM:41:@VM:41:@VM:42:@VM:43 FIND 41 IN DA,2 SETTING F,V,S ELSE PRINT "NOT FOUND" FIND 1-261
- 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
- Page 260 and 261: Parameters he following table descr
- Page 262 and 263: END Syntax END Description The UniB
- Page 264 and 265: Related Commands UniBasic CALL, CHA
- Page 266 and 267: Examples In the following example,
- Page 268 and 269: EQU Syntax EQU constant1 TO value1
- Page 270 and 271: In the next example, UniData replac
- Page 272 and 273: EXECUTE Syntax EXECUTE "str.expr" [
- Page 274 and 275: Parameter Description Reminder: The
- Page 276 and 277: Related Commands UniBasic COMMON, E
- Page 278 and 279: Parameter Description Examples In t
- Page 280 and 281: The program output is: 1-274 UniBas
- Page 282 and 283: EXP Syntax EXP(expr) Description Th
- Page 284 and 285: Examples The following program segm
- Page 286 and 287: In the next example, the program se
- Page 288 and 289: Options The value of option determi
- Page 290 and 291: FILEINFO Syntax FILEINFO(file.var,
- Page 292 and 293: Code 9 Merge factor percentage 10 S
- Page 294 and 295: FILELOCK Syntax FILELOCK [file.var]
- Page 296 and 297: FILEUNLOCK Syntax FILEUNLOCK [file.
- Page 300 and 301: Related Commands UniBasic [], FINDS
- Page 302 and 303: Parameter Description Examples In t
- Page 304 and 305: FMT Syntax FMT(expr, "len [f.char]
- Page 306 and 307: STATUS Function Return Values After
- Page 308 and 309: FOOTING Syntax FOOTING [ON num.expr
- Page 310 and 311: Related Commands UniBasic GETPTR, H
- Page 312 and 313: This program segment produces the f
- Page 314 and 315: Parameter Description Examples The
- Page 316 and 317: FUNCTION Syntax FUNCTION function.n
- Page 318 and 319: The following program calls the pre
- Page 320 and 321: GE Syntax expr1 GE expr2 Synonyms #
- Page 322 and 323: generateKey Syntax generateKey(priv
- Page 324 and 325: Return Code Status 1-286 UniBasic C
- Page 326 and 327: GET Syntax GET[X] var[,length] [SET
- Page 328 and 329: Example In the following example, t
- Page 330 and 331: Parameters The following table desc
- Page 332 and 333: getHTTPDefault Syntax getHTTPDefaul
- Page 334 and 335: GETLIST Syntax GETLIST list.name [,
- Page 336 and 337: UniData SQL SELECT - For informatio
- Page 338 and 339: STATUS Function Return Values After
- Page 340 and 341: GETQUEUE Syntax GETQUEUE() Descript
- Page 342 and 343: GETREADU Syntax GETREADU() Descript
- Page 344 and 345: getResponseHeader Syntax getRespons
- Page 346 and 347: The following table describes each
Parameter Description<br />
f,v,s Specifies variables in which to place the position of expr:<br />
f – Attribute<br />
v – Value<br />
s – Subvalue<br />
If the attribute found has neither multivalues nor subvalues, then v and s, if<br />
specified, are set to 0. If only multivalues are present, s is set to 0. If only<br />
subvalues exist, v is also set to 0.<br />
THEN<br />
statements<br />
ELSE<br />
statements<br />
For more information about writing THEN...ELSE parameters, see Developing<br />
<strong>UniBasic</strong> Applications. The <strong>UniBasic</strong> FIND and LOCATE commands are compared<br />
in this manual.<br />
Examples<br />
Specifies statements to execute if the expr is found in the array. END is<br />
required when statements extend over more than one line. Either a THEN<br />
statement or an ELSE statement is required.<br />
Specifies statements to execute if the expr is not found in the array. END is<br />
required when statements are multiline. Either a THEN statement or an<br />
ELSE statement is required.<br />
FIND Parameters (continued)<br />
In the following example, the program segment searches for an occurrence of 31 in<br />
the string DA. This results in F=3, V=1, and S=0 because 31 is found in the third<br />
attribute as the first multivalue, and this attribute has no subvalues.<br />
001: DA = 1:@AM:2:@AM:31:@VM:32:@VM:41:@VM:41:@VM:42:@VM:43<br />
002: FIND 31 IN DA SETTING F,V,S THEN<br />
003: PRINT "F=":F:" V=":V:" S=":S<br />
004: END ELSE<br />
005: PRINT "NOT FOUND"<br />
006: END<br />
In the next example, the program segment searches for the second occurrence of 41<br />
in the string DA. This results in F=3, V=4, and S=0 because the second occurrence<br />
of 41 is found in the third attribute as the fourth multivalue, and this attribute has no<br />
subvalues.<br />
DA = 1:@AM:2:@AM:31:@VM:32:@VM:41:@VM:41:@VM:42:@VM:43<br />
FIND 41 IN DA,2 SETTING F,V,S ELSE PRINT "NOT FOUND"<br />
FIND 1-261