|
I wrote a small testcase and found you can write to a member as long as the member exists before running the Java program. The source for my test is: FileOutputStream f = new FileOutputStream("/QSYS.LIB/DAW.LIB/DAW.FILE/A.MBR"); PrintWriter pw = new PrintWriter(f); pw.write("line 1"); pw.write("line 2"); pw.flush(); pw.close(); f.close(); If I first create the member data was written to the file. If I do not create the member, I get a FileNotFound exception. I will not speak for the value of the data, however. Since java.io classes write the data it ends up being unicode. If an AS/400 app is going to digest the data, I hope it can handle unicode. As mentioned in another append, the Toolbox has classes to write to the IFS and will convert the data. I re-wrote my test case to: AS400 system = new AS400(); IFSTextFileOutputStream f = new IFSTextFileOutputStream(system, "/QSYS.LIB/DAW.LIB/DAW.FILE/A.MBR", 37); f.write("line 1 \n"); f.write("line 2 \n"); f.flush(); f.close(); The data written to the file is EBCDIC so I am able to use AS/400 tools (like SEU) to edit the same file. Also, the Toolbox class creates the file if it doesn't exist so the file does not have to exist before the Java program runs. If you don't have access to the source then you can't change the app to use Toolbox classes but it is an option if you have access to the source. David Wall AS/400 Toolbox for Java Folks: Does anyone know if it's possible for a java program, running on the '400, to write to a source pf? The output file I want to write to is /QSYS.LIB/DEVDMGWRK.LIB/JAVAOUT.FILE/JAVAOUT.MBR The java program I'm running (and I admit, I don't know much about it currently) complains that it can't find the file. Thanks! david +--- | This is the JAVA/400 Mailing List! | To submit a new message, send your mail to JAVA400-L@midrange.com. | To subscribe to this list send email to JAVA400-L-SUB@midrange.com. | To unsubscribe from this list send email to JAVA400-L-UNSUB@midrange.com. | Questions should be directed to the list owner: joe@zappie.net +--- +--- | This is the JAVA/400 Mailing List! | To submit a new message, send your mail to JAVA400-L@midrange.com. | To subscribe to this list send email to JAVA400-L-SUB@midrange.com. | To unsubscribe from this list send email to JAVA400-L-UNSUB@midrange.com. | Questions should be directed to the list owner: joe@zappie.net +---
As an Amazon Associate we earn from qualifying purchases.
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.