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™ data definition specification (DDS) keywords that further describe the field.

Field description classes

The field description classes are as follows:

Example: Creating field descriptions

The following example assumes 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) that you can describe with field descriptions:

     // 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");

You can now group the field descriptions in an instance of the RecordFormat class. To see how to add the field descriptions to a RecordFormat object, see the example on the following page:

RecordFormat class