So, again, I dig this up from my NAS and hopefully it helps. It is something from 10 years ago I kinda forgot why I ended up creating RecordFormat like this, but it worked for me at that time lol. Since I don't work in a place with the IBM machine anymore I just can't verify or test it. Should you find any problem please let me know.
package com.jvtech.as400; import java.io.IOException; import com.ibm.as400.access.*; /** * * @author Stanley Vong * * * @version 1.0 (March 28, 2005) * Initial Creation. * */ public class DynamicRecordFormat extends RecordFormat{ /** * Create an instance of RecordFormat using the AS400 and QSYSObjectPathName as reference. * @param as400 * @param filePathName * @throws AS400Exception * @throws AS400SecurityException * @throws InterruptedException * @throws IOException */ public DynamicRecordFormat(AS400 as400, QSYSObjectPathName filePathName) throws AS400Exception, AS400SecurityException, InterruptedException, IOException { super (filePathName.getObjectName()); AS400FileRecordDescription recordDescription = new AS400FileRecordDescription(as400, filePathName.getPath()); RecordFormat[] fileFormat = recordDescription.retrieveRecordFormat(); if (fileFormat.length > 1){ throw new IllegalArgumentException(filePathName.getPath() + " contains more than one record format."); } //always default to fileFormat[0] cause only physical files are assumed here. FieldDescription fd = null; for (int i = 0; i < fileFormat[0].getNumberOfFields(); i++){ fd = fileFormat[0].getFieldDescription(i); addFieldDescription(fd); } } }
thank you . i'll try it.
ReplyDeletejust another question please.
ReplyDeleteme too, i need to identify transactions (insert/update/delete) to files and report per day the list of files with transactions. how to use your API to track them ?