The scalar and compound data types may be combined into arrays as follows:
Description
|
Example
|
Fixed arrays of scalars
|
MAP1 SALES(25),F,6
|
Fixed compound arrays
|
MAP1 CUST(10)
MAP2 NAME,S,30
MAP2 CUSNO,B,4
MAP2 SALES(25),F,6
...
for I = 1 to 10
? NAME(I),CUSTNO(I)
for J = 1 to 25
? SALES(I,J)
next J
next I
|
Dynamic Array
|
ECOUNT = 1000
ESIZE = 50
dimx MESSAGES(ECOUNT),S,ESIZE ! dynamically allocate array
...
redimx MESSAGES(2000) ! increase extent of array
...
redimx MESSAGES(0) ! discard array
|
Dynamic Array of Structures
|
dimx CUSRECS(50),ST_CUST ! array of 50 ST_CUST structures
...
? CUSRECS(25).CUSNO ! element.member notation
|
Dynamic auto-extended arrays; may be either scalar or structure types
|
dimx CUSRECS(0),ST_CUST,auto_extend
...
CUSRECS(N).NAME = "MicroSabio" ! auto-expand to N elements
! if needed (on assignment)
|
Multi Level List
|
dimx $JSONDOC, mlist(varstr) ! JSON doc stored as multi-level list
...
$JSONDOC(.pushback) = name$ + ":" + value$ ! push name:value pair on end of list
|
Subtopics
•Dynamic Arrays (DIMX)