DataTable part in EGL source format

You declare a dataTable part in an EGL source file, which is described in EGL projects, packages, and files. This part is a generatable part, which means that it must be at the top level of the file and must have the same name as the file.

A dataTable is related to a program by the program's use declaration or (in the case of the program's only message table) by the program's msgTablePrefix property. A dataTable is related to a pageHandler by the pageHandler's use declaration.

An example of a dataTable part is as follows:
     DataTable myDataTablePart type basicTable
       { 
         { shared = yes }
         myColumn1 char(10);
         myColumn2 char(10);
         myColumn3 char(10);

 
         { contents = [  
          [ "row1 col1", "row1 col2", "row1 " + "col3" ] ,
          [ "row2 col1", "row2 col2", "row2 " + "col3" ] ,  
          [ "row3 col1", "row3 col2", "row3 col3"      ]
                    ]
       } 
     end
The syntax diagram for a dataTable part is as follows:

Syntax diagram for a dataTable part
DataTable dataTablePartName ... end
Identifies the part as a dataTable and specifies the part name. For the rules of naming, see Naming conventions.
basicTable (the default)
Contains information that is used in the program logic; for example, a list of countries and related codes.
matchInvalidTable
Is specified in the validatorDataTable property of a text field to indicate that the user's input must be different from any value in the first column of the dataTable. The EGL runtime acts as follows in response to a validation failure:
  • Accesses the table referenced in the validatorDataTable property
  • Retrieves the message identified by the validatorDataTableMsgKey property that is specific to the text field
  • Displays the message in the text field identified in the form-specific msgField property
matchValidTable
Is specified in the validatorDataTable property of a text field to indicate that the user's input must match a value in the first column of the dataTable. The EGL runtime acts as follows in response to a validation failure:
  • Accesses the table referenced in the validatorDataTable property
  • Retrieves the message identified by the validatorDataTableMsgKey property that is specific to the text field
  • Displays the message in the field identified in the form-specific msgField property
msgTable
Contains runtime messages. A message is presented in the following circumstance:
  • The table is the message table for the program. The association of DataTable to program occurs if the program property msgTablePrefix references the table prefix, which is the first one to four characters in the name of the DataTable. When you name the message table, you include a three-character code to represent the national language, as shown in the table displayed next.

    Language National language code
    Brazilian Portugese PTB
    Chinese, simplified CHS
    Chinese, traditional CHT
    English, uppercase ENP
    English, USA ENU
    French FRA
    German DEU
    Italian ITA
    Japanese, Katakana (single-byte character set) JPN
    Korean KOR
    Spanish ESP
    Swiss German DES
  • The program retrieves and presents a message by one of two mechanisms, as described in ConverseLib.displayMsgNum and ConverseLib.validationFailed.
rangeChkTable
Is specified in the validatorDataTable property of a text field to indicate that the user's input must match a value that is between the values in the first and second column of at least one data-table row. (The range is inclusive; the user's input is valid if it matches a value in the first or second column of any row.) The EGL runtime acts as follows in response to a validation failure:
  • Accesses the table referenced in the validatorDataTable property
  • Retrieves the message identified by the validatorDataTableMsgKey property that is specific to the text field
  • Displays the message in the field identified in the form-specific msgField property
"alias"
A string that is incorporated into the names of generated output. If you do not specify an alias, the dataTable name is used instead.
shared
Indicates whether the same instance of a dataTable is used by multiple programs in the same run unit. Valid values are yes and no (the default). If the value of shared is no, each program in the run unit has a unique copy of the dataTable.

The property indicates whether the same instance of a dataTable is used by every program in the same run unit. If the value of shared is no, each program in the run unit has a unique copy of the dataTable.

Changes made at run time are visible to every program that has access to the dataTable, and the changes remain until the dataTable is unloaded. In most cases, the value of the resident property (described later) determines when the dataTable is unloaded; for details, see the description of that property.

resident
Indicates whether the dataTable is kept in memory even after every program that accessed the dataTable has ended.

Valid values are yes and no. The default is no.

If you set the resident property to yes, the dataTable is shared regardless of the value of shared.

The benefits of making a dataTable resident are as follows:
  • The dataTable retains any values written to it by programs that ran previously
  • The table is available for immediate access without additional load processing

A resident dataTable remains loaded until the run unit ends. A non-resident dataTable, however, is unloaded when the program that uses it ends.

Note: A dataTable is loaded into memory (if necessary) at a program's first access, and not when the EGL runtime processes a use declaration.
contents
The value of the dataTable cells, each of which is one of the following kinds:
  • A numeric literal
  • A string literal or a concatenation of string literals

The kind of content in a given row must be compatible with the top-level structure fields, each of which represents a column definition.

structureField
A structure field, as described in Structure field in EGL source format.

Related concepts
DataTable
EGL projects, packages, and files
Run unit

Related reference
Naming conventions
Structure field in EGL source format
displayMsgNum()
validationFailed()
Use declaration

Feedback
(C) Copyright IBM Corporation 2000, 2005. All Rights Reserved.