Understanding type definition

This is an introduction to types.

The TYPE instruction declares a user-defined type, which can be based on:

Once declared, a type can be referenced in the declaration of program variables, or in other types.

Types are typically defined to avoid the repetition of complex structured types.

Tip: User-defined types improve code readability by centralizing data structure definitions. Consider using PUBLIC TYPE definitions to share types across modules with IMPORT FGL.

Types can also be completed with methods to encapsulate the data, and use the concept of polymorphism with interfaces.

What are anonymous types?

While user-defined types are defined with the TYPE instruction and are identified by a name, anonymous types are created automatically by the runtime system when defining variables with a complete type specification (not with a user-defined type).

For example:
DEFINE name VARCHAR(50)
DEFINE cust_rec RECORD
           cust_id INTEGER,
           cust_name VARCHAR(50)
       END RECORD
DEFINE cust_list DYNAMIC ARRAY OF

The above