|
I'm using the following code to read all the records from one file
(fileVAL) with keys matching the key in another file (fileINF).
Occasionally, I'll get records from fileVal that are greater than the
search key. Not always. Most of the time, I'll get a null back from
the readNextEqual() when the next record in the file has a higher
value for the key. fileINF is set as unique(*yes) and fileVal is set
as unique(*no). The key is defined as eight characters long, CCSID 37,
collating sequence *HEX. The value is an ever incrementing 8-byte
unsigned integer. Are there values where, perhaps when the low order
byte is somewhere in the hex 00 to hex 20 range, that
readNextEqual() will consider different values as equal?
fileINF.positionCursorBeforeFirst();
recordINF = fileINF.readNext();
if (recordINF != null) {
String result=null;
this.doAnother = !((String)(recordINF.getKeyFields()[0])).equals("**QUIT**");
if (doAnother){
this.doAnother=true;
Object[] keys = recordINF.getKeyFields();
String uniqueId = recordINF.getField(0).toString();
WorkpieceCreationInfo wpCreate = new WorkpieceCreationInfo(
recordINF.getField(1).toString().trim(),
recordINF.getField(2).toString().trim(),
recordINF.getField(3).toString().trim(),
recordINF.getField(4).toString().trim());
log.debug("FLOCWPINF read"+
"\n\t"+recordINF.getField(0).toString().trim()+
"\n\t"+recordINF.getField(1).toString().trim()+
"\n\t"+recordINF.getField(2).toString().trim()+
"\n\t"+recordINF.getField(3).toString().trim()+
"\n\t"+recordINF.getField(4).toString().trim());
{
Record recordVAL = null;
try {
do {
if (recordVAL != null) {
wpCreate.addValue(
recordVAL.getField(1).toString().trim(),
recordVAL.getField(2).toString().trim());
log.debug("FLOCWPVAL read"+
"\n\t"+recordVAL.getField(0).toString().trim()+
"\n\t"+recordVAL.getField(1).toString().trim()+
"\n\t"+recordVAL.getField(2).toString().trim());
}
} while (recordVAL != null);--
} catch (AS400Exception e){
// nothing in the file for the key
}
}
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.