Definition attributes

Variables can be defined with meta-data information.

Basics

To specify metadata information when defining a variable, use the ATTRIBUTES clause:
DEFINE myvar INTEGER ATTRIBUTES

JSON serialization attributes

To define JSON serialization options, use variable definition attributes such as json_null and json_name:
DEFINE rec RECORD
   cust_id INTEGER ATTRIBUTES(json_null="null"),
   cust_name INTEGER ATTRIBUTES(json_name="Customer Name"),
   ...
   orderlist DYNAMIC ARRAY ATTRIBUTES(json_null="undefined") OF RECORD
      ...
      END RECORD,
   ...
 END RECORD
List of supported JSON attributes for variable definitions:
  • json_null (values can be "null" or "undefined")
  • json_name

For more details about JSON serialization attributes see BDL names and JSON element names.

XML serialization attributes

Variable attributes are also used when defining variables for XML-based Web Services:
DEFINE data RECORD ATTRIBUTES(XMLName="Demo"),
     val1 INTEGER ATTRIBUTES(XMLName= "Value1"),
     val2 STRING ATTRIBUTES(XMLName= "Value2")
     attr INTEGER ATTRIBUTES(XMLAttribute,XMLName= "MyAttr")
END RECORD

For more details about XML attributes, see Attributes to customize XML serialization.