FieldDescription classes

The field description classes allow the Java program to describe the contents of a field or parameter with a data type and a string containing the name of the field. If the program is working with data from record-level access, it can also specify any iSeries or AS/400e data definition specification (DDS) keywords that further describe the field.

The field description classes are as follows:

For example, assume that the entries on a data queue have the same format. Each entry has a message number (AS400Bin4), a time stamp (8 characters), and message text (50 characters). These can be described with field descriptions as follows:

                       // Create a field description for
                       // the numeric data. Note it uses
                       // the AS400Bin4 data type. It also
                       // names the field so it can be
                       // accessed by name in the record
                       // class.
     BinaryFieldDescription bfd = new BinaryFieldDescription(new AS400Bin4(),
                                                             "msgNumber");

                       // Create a field description for
                       // the character data. Note it uses
                       // the AS400Text data type. It also
                       // names the field so it can be
                       // accessed by name by the record
                       // class.
     CharacterFieldDescription cfd1 = new CharacterFieldDescription(new AS400Text(8),
                                                                    "msgTime");

                       // Create a field description for
                       // the character data. Note it uses
                       // the AS400Text data type. It also
                       // names the field so it can be
                       // accessed by name by the record
                       // class.
     CharacterFieldDescription cfd2 = new CharacterFieldDescription(new AS400Text(50),
                                                                    "msgText");

The field descriptions are now ready to be grouped in a record format class. The example continues in the record format section.