Arrays

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 arrays of scalars

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 arrays 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)

Ordered Maps

dimx $CAPITALS, ordmap(varstr;varstr)     ! map of strings
...
$CAPITALS("FRANCE") = "PARIS"

dimx $STATES, ordmap(varstr;varx)      ! map of blobs/structures
...

Map1 STATE,ST_STATE

...

$STATES(“California”) = STATE        ! load structure into map

...

STATE = $STATES(“California”)       ! retrieve structure from map by key

? STATE.POPULATE, STATE.CAPITAL, …  ! access members

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