× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hi Thorbjørn,
I am not sure why you are using IFS classes when you are working with iSeries 
database files, but maybe I am outdated on this.
See the enclosed keyed file example and sequential file access java program 
from jt400.
If you need to create a member in a file, you could use the command call:
CommandCall c = new CommandCall(system, "ADDPFM FILE(library/filename) 
MBR(membername)");
Best regards,
Magne

>-----Original Message-----
>From: Thorbjørn Ravn Andersen [mailto:thunderaxiom@xxxxxxxxx]
>Sent: Tuesday, February 28, 2006 07:51 AM
>To: 'Java Programming on and around the iSeries / AS400'
>Subject: Create a member in a given file?
>
>I need to create a member in a file. 
>
>I have the full name of the member file in an IFSFile object (i.e. 
>/QSYS.LIB/XQ41EXI01.LIB/EDIPOMATCE.FILE/MACT9S0BYG.MBR) and I intend to 
>open it as a SequentialFile, create a Record per line and put in the 
>data I need, and write it to the SequentialFile. 
>
>Currently my code looks pretty much like:
>
>----
> IFSFile logMember = new IFSFile(system, 
>logFile.getAbsolutePath() + "/" + member.getName());
> 
> if (logMember.exists()) {
> throw new IllegalStateException("Member already exists in 
>error file " + logMember);
> }
>
> SequentialFile sequentialFile = 
>getSequentialFileWithRecordFormatSet(system, logMember.getAbsolutePath());
> sequentialFile.open();
> sequentialFile.positionCursorAfterLast();
> 
> Record record1 = sequentialFile.getRecordFormat().getNewRecord();
> record1.setField(0, "UNB01PEVRETUR");
> sequentialFile.write(record1);
>--.-. where getSequentialFile looks like
>
> private SequentialFile getSequentialFileWithRecordFormatSet(AS400 
>system, String absolutePath) throws AS400Exception, 
>AS400SecurityException, InterruptedException, IOException, 
>PropertyVetoException {
> AS400FileRecordDescription recordDescription = new 
>AS400FileRecordDescription( system, absolutePath);
>
> SequentialFile sequentialFile = new SequentialFile(system, 
>absolutePath);
> RecordFormat[] retrieveRecordFormat = 
>recordDescription.retrieveRecordFormat();
> if (retrieveRecordFormat.length != 1) {
> log.warn("file does not have exactly one member: " + 
>absolutePath);
> }
> RecordFormat recordFormat = retrieveRecordFormat[0];
> sequentialFile.setRecordFormat(recordFormat);
> return sequentialFile;
> }
>
>------
>
>This is very similar to what I do when reading from a member, but the 
>only create method I can find creates the sequentialFile, not the 
>member. Apparently "create member" is not the right term to search for 
>either in google or the toolbox manual, so I am a bit lost now. I don't 
>grok Cobol, so I have no idea what it might be called instead.
>
>I would appreciate a gentle hint in the right direction.
>
>Best regards,
>-- 
> Thorbjørn
>-- 
>This is the Java Programming on and around the iSeries / AS400 (JAVA400-L) 
>mailing list
>To post a message email: JAVA400-L@xxxxxxxxxxxx
>To subscribe, unsubscribe, or change list options,
>visit: http://lists.midrange.com/mailman/listinfo/java400-l
>or email: JAVA400-L-request@xxxxxxxxxxxx
>Before posting, please take a moment to review the archives
>at http://archive.midrange.com/java400-l.
>
>


As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.