Chapter 7. I/O using the JZOS toolkit API 125
System.out.println("Record3 Update \t:" +
printBytes(recBuf,nRead));
// delete all of the records
zfile.locate(rec_1, 0, keyLen, ZFile.LOCATE_KEY_EQ);
nRead = zfile.read(recBuf); // have to read a rec b4
updating
zfile.delrec();
zfile.locate(rec_2, 0, keyLen, ZFile.LOCATE_KEY_EQ);
nRead = zfile.read(recBuf);
zfile.delrec();
zfile.locate(rec_3, 0, keyLen, ZFile.LOCATE_KEY_EQ);
nRead = zfile.read(recBuf);
zfile.delrec();
} finally {
zfile.close();
}
}
/**
* Pad a string with spaces to a specified length
*/
static String padToLength(String s, int len) {
StringBuffer sb = new StringBuffer(len);
sb.append(s);
for (int i = s.length(); i < len; i++)
sb.append('@');
return sb.toString();
}
/**
* Check ...