× 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.



Hiya,
      little confused by your mail, if you already have the member name as
part of the name supplied to the class, then the member either already
exists in the file or should get created when you create the file.

If you are looking to add an extra member to the file, try the addPhyical
FileMember(String name,  String description) method. This can be found in
the documentation for the AS400File Class which is a super class of
SequentialFile.

regards


James O'Sullivan
Senior Technical Consultant
email: josulli4@xxxxxxx
Office: +44 1252 536681
Fax: +44 1252 534022
www: www.csc.com
Based at: Tower 2, Floor 2, Royal Pavilion, Wellesley Road, Aldershot,
Hampshire, GU11 1PZ

CSC Corporation Limited: No. 1812179.
All registered office addresses: Royal Pavilion, Wellesley Road, Aldershot,
Hampshire, GU11 1PZ. Registered in England.


--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

This is a PRIVATE message. If you are not the intended recipient, please
delete without copying and kindly advise us by e-mail of the mistake in
delivery. NOTE: Regardless of content, this e-mail shall not operate to
bind CSC to any order or other contract unless pursuant to explicit written
agreement or government initiative expressly permitting the use of e-mail
for such purpose.
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------




                                                                           
             Thorbjørn Ravn                                                
             Andersen                                                      
             <thunderaxiom@gma                                          To 
             il.com>                   Java Programming on and around the  
             Sent by:                  iSeries / AS400                     
             java400-l-bounces         <java400-l@xxxxxxxxxxxx>            
             @midrange.com                                              cc 
                                                                           
                                                                   Subject 
             28/02/2006 12:51          Create a member in a given file?    
                                                                           
                                                                           
             Please respond to                                             
             Java Programming                                              
             on and around the                                             
              iSeries / AS400                                              
             <java400-l@midran                                             
                  ge.com>                                                  
                                                                           
                                                                           




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 ...

Replies:

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.