Array attributes
Arrays can be defined with attributes, to complete the type description.
Syntax
where attributes-list is:
ATTRIBUTES ( attribute [ = "value" ] [,...] )- attribute is the name of a definition attribute.
 - value is the value for the definition attribute, it is optional for boolean attributes.
 
Usage
Arrays can be defined with the ATTRIBUTES() clause, to specify meta-data
information for the array.
In the next code example, the array type definition gets definition attributes, to specify the
corresponding field names for JSON serialization:
IMPORT util
  
TYPE t_items DYNAMIC ARRAY ATTRIBUTES(json_name="items") OF
     RECORD
         item_num INTEGER ATTRIBUTES(json_name="id"),
         item_desc VARCHAR(50)
     END RECORD
DEFINE stock RECORD
         itemlist t_items
     END RECORD
MAIN
    LET stock.itemlist[1].item_num = 998
    LET stock.itemlist[1].item_desc = "Hand gloves"
    LET stock.itemlist[2].item_num = 999
    LET stock.itemlist[2].item_desc = "Blue hat"
    DISPLAY util.JSON.format(util.JSON.stringify(stock))
END MAINOutput:
{
    "items": [
        {
            "id": 998,
            "item_desc": "Hand gloves"
        },
        {
            "id": 999,
            "item_desc": "Blue hat"
        }
    ]
}Array attributes are part of the attributes specification for variables.