Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

@Structure, @Fields, @Indexes

Only apply to table files (@Properties/Type : "Table").

@Structure

KeyDescription
NameTable name. Must start with a letter, letters/digits only, max 10 characters (DDS object name limit).
Record Format (or RecordFormat)Optional. Record format name (the DDS R line) of the PF and of every LF; the generated RPG uses it in rename(<format> : row). Without it, the format is named like the table (Name). The physical/logical file name and the LF PFILE() remain the table name. Useful for tables that already exist on the IBM i whose format differs from the file name. Up to 10 characters, letters and digits only, starting with a letter (E00349 otherwise).
DescriptionTable description.
@Structure {
    Name : ORDERS
    Record Format : ORDREC
    Description : "Orders"
    ...
}

Also contains, nested: @Fields, @Indexes and optionally @Documentation (see @Documentation).

@Fields

One Name type(...) line per column:

@Fields {
    CustCode char(6)   Description("Customer code")
    Name     char(20)  Description("Name")
    Balance  number(9,2) Default(0)
    RegDate  date
}

Allowed types: only char, number, date (not field/list/matrix — those are exclusive to @Variables, see Data types).

Modifiers:

ModifierDescription
Description("text")Field description. Requires a quoted string.
Default(value)Default value: a quoted string or a bare number, depending on the field’s type. Not allowed on date fields.
AllowNullAllows NULL on this field. A PrimaryKey field can’t carry this modifier.

@Indexes

One Kind(Name, [Fields...], "optional description") entry per access path:

@Indexes {
    PrimaryKey ( GRIDDEMOPK, [CustCode] )
    Unique     ( GRIDDEMOEMAIL, [Email], "Unique email" )
    Index      ( GRIDDMNOM, [Name] )
}
KindDescription
PrimaryKeyThe table’s primary access path. Only one per table; its fields can’t be AllowNull.
UniqueUnique secondary access path.
IndexNon-unique secondary access path.

Full example

@Properties {
    Type : "Table"
}
@Structure {
    Name        : "GRIDDEMO"
    Description : "Sample customers"
    @Fields {
        CustCode char(6)   Description("Customer code")
        Name     char(20)  Description("Name")
        City     char(15)  Description("City")
    }
    @Indexes {
        PrimaryKey ( GRIDDEMOPK, [CustCode] )
        Index ( GRIDDMNOM, [Name] )
    }
}