RecordThe record class allows the Java program to process data described by the record format class. Data is converted between byte arrays containing the AS/400 data and Java objects. Methods are provided in the record class to do the following:
For example, to use the record format created in the record format example: |
// Assume data queue setup work has // already been done. Now read a // record from the data queue. DataQueueEntry dqe = dq.read(); // The data from the data queue is // now in a data queue entry. Get // the data out of the data queue // entry and put it in the record. // We obtain a default record from // the record format object and // initialize it with the data from the // data queue entry. Record dqRecord = rf.getNewRecord(dqe.getData()); // Now that the data is in the // record, pull the data out one // field at a time, converting the // data as it is removed. The result // is data in a Java object that the // program can now process. Integer msgNumber = (Integer) dqRecord.getField("msgNumber"); String msgTime = (String) dqRecord.getField("msgTime"); String msgText = (String) dqRecord.getField("msgText");
[ Legal | AS/400 Glossary ] |