× 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 Patrick,

> tried using java.io.RandomAccessFile...
> but got the orginal undesired results.

    Hmm, I'm surprised.  Something resembling:

import java.io.*;

public class TestWriteAS400File
{
  public static void main(String[] args) throws Exception
  {
    RandomAccessFile raf =
      new RandomAccessFile("myFileName", "rw");

    raf.seek( 0 );
    raf.writeChars( "I want this to be record 1" );
    raf.seek( 132 );
    raf.writeChars( "I want this to be record 2" );
    raf.seek( 264 );
    raf.writeChars( "I want this to be record 3" );

    raf.close();
  }  // end main

} // end


should work.  Worst case, I would think, writing 132 byte arrays again.

    Sorry, can't test until tomorrow, if then.  Got to head out to a local
JUG meeting.


                                                  Joe Sam

Joe Sam Shirah -        http://www.conceptgo.com
conceptGO         -        Consulting/Development/Outsourcing
Java Filter Forum:       http://www.ibm.com/developerworks/java/
Just the JDBC FAQs: http://www.jguru.com/faq/JDBC
Going International?    http://www.jguru.com/faq/I18N
Que Java400?             http://www.jguru.com/faq/Java400


----- Original Message -----
From: "Patrick L Archibald" <Patrick.Archibald@xxxxxxxxxxxxx>
To: "Java Programming on and around the iSeries / AS400"
<java400-l@xxxxxxxxxxxx>
Sent: Tuesday, March 30, 2004 3:30 PM
Subject: Re: Writing to an AS/400 physical file with fileOutputStream


> Joe Sam,
>
> You are correct on all points.
>
>
> I changed the class so that it space-padded the data to 132 and it wrote
three records like I wanted.
>
>
>
> I changed the class again and tried using java.io.RandomAccessFile and
> even did java.io.RandomAccessFile.setLength(132) on the file but got the
> orginal undesired results.
>
>
>
> Thanx for the suggestions, PLA
>



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.