Field

General attributes

Each Field definition consists of the Field name followed by a set of attributes. The Field name is the name that the Model Developer uses in the Model Document. The name of a field should start with an uppercase character and can be followed by lowercase characters, uppercase characters, digits or underscores '_'.

Type, each Field must have a type. The type consist of a type name and an optional length definition and optional alignment information. The ITP DID language allows you to use all types in DID Modules of every connection. The types that you define here are the types of the Fields that ITP retrieves. ITP converts these types during Model execution by mapping the values to values of the types of the ITP Language (NUMBER, TEXT and BOOL).
Not all data types are meaningful in all connection types. ITP interprets the values as if they have the specified type. This can give unexpected results or cause errors during Run Model, when the value is formatted for another type then the type specified, e.g., a value containing a number in a PACKED format for a field specified as a ZONED or NUMERICAL data typed or a value containing a C_CHAR value for a field specified as TEXT.

Length, whether a Field should have a length definition depends on the type. Some numerical types have a double length definition. In such instances, the first parameter indicates the byte size of the Field. The second parameter indicates the number of decimals. For null-terminated data types such as C_CHAR, W_CHAR or NUMERICAL the null character should be included in the byte-count.

Alignment, all definitions textual Fields can contain alignment information. When a Field is left aligned ITP will strip all spaces at the end of the Field. When a Field is right aligned ITP will strip all spaces at the beginning of the Field. ITP assumes left alignment by default.

Database Field, some Database Management Systems use naming conventions that yield names that are invalid according to the ITP naming convention. In some connection types, ITP queries the DBMS directly. Therefore, ITP has to know how the Field or column is known in the DBMS. The Database Field attribute can be used to store this name. The value of the Database Field attribute can be any string that is a valid Field or column specification. Which values are valid, depends on the connection type.

Screen Field, each Field can have a screen Field attribute. The screen Field attribute is in some connection types used to construct a Key Retrieval definition automatically. See the appropriate section in ITP Connection Types chapter of the DID Developer Manual for more information. The screen Field attribute expects a natural number. These natural numbers specify the order in which the screen Fields are presented. The lower numbers go first. When you specify the same number twice, ITP determines the order for the Fields concerned itself. There may be gaps between the screen Field numbers.

AS/400 Connection attributes

Offset, in AS/400 Connection Entries, you can specify an offset for each Field. When you specify offsets, you also have to specify a record length for the Entry. If the record length attribute is missing from the Entry ITP will generate an error message during DID creation. When the offset attribute is missing ITP assumes an offset of 0.
When you use the offset attribute in other connection type DID Modules ITP generates an error message during DID creation.

Grammar

field-sequence ::=
field-def [ field-sequence ]
field-def ::=
field-name field-type-description
field-type-description ::=
file-field-type
[ database-field-name ]
[ screen-field-def ]
[ as400‑connection‑field-attributes ]
file-field-type ::=
ZONED field-type-length-double
| PACKED field-type-length-double
| BINARY field-type-length-double
| NUMERICAL field-type-length-double
| DOUBLE
| TEXT field-type-length-single [ alignment_info ]
| C_CHAR field-type-length-single
| W_CHAR field-type-length-single
field-type-length-double ::=
[ LENGTH ] '(' natural-number natural-number ')'
field-type-length-single ::=
[ LENGTH ] '(' natural-number ')'
alignment-info ::=
[ ALIGNMENT ] direction-alignment
direction-alignment ::=
LEFT_ADJUSTED
| RIGHT_ADJUSTED
database-field-name ::=
DATABASE_FIELD field-specification
screen-field-def ::=
SCREEN_FIELD natural-number
as400-connection-field-attributes ::=
database-offset
database-offset ::=
OFFSET natural-number
Example
Customer_number	NUMERICAL LENGTH(10 0)	DATABASE_FIELD "CUSTNO"
Customer_surname TEXT LENGTH(50) DATABASE_FIELD "CUSTSNAM"
Customer_name TEXT LENGTH(50) DATABASE_FIELD "CUSTNAME"