|
---------- I contacted Mark off-list because it wasn't clear to me if Colin's response resolved things and I didn't want to clutter the list with just an inquiry. Mark's response is below and I will refer to it later on. ---------- I will just briefly state my opinion that the biggest problem is calling Java apps from RPG. It seems cool, but there are lots of issues, and performance/memory becomes a real headache with multiple users. We never have these problems because we just don't do it. JNI has its place, but normally asynchronous processing is the answer. We use messaging due to several benefits; others do the same with data queues. BTW, my conclusions are educated guesses. We don't do things this way, so it has zero educational value for me, and as a business owner I don't get to eat unless I bill, so there's no incentive to go through testing. With that said, First, standard IFS files are in ASCII. I think your initial problem is that EBCDIC is getting loaded into the file. From what I can tell about QIBM_USE_DESCRIPTOR_STDIO, while most of the documentation deals with PASE and C code, I think the RPG programs job log and/or messages are getting put to the IFS file as stdout and stderr. I may be wrong, but it fits your description. So, the first thing I would try is ditching that environment variable. See File systems < http://publib.boulder.ibm.com/iseries/v5r2/ic2924/index.htm?info/rzalf/rzalffilesystems.htm > for *some* information. Next, I wouldn't use SystemDefault.properties. That could get to be a maintenance headache one way or another. In addition, I suspect that it would cause previous data to be overwritten, although I'm not 100% certain of that - depends on how the default out/err is opened. Colin's code ( which includes buffering ) should work fine. The general basic form is: // set out, err System.setErr( new PrintStream( new FileOutputStream( "/myDir/myLog.log", true ) ) ); System.setOut( new PrintStream( new FileOutputStream( "/myDir/myLog.log", true ) ) ); Two things about your code below: You never set System.out or System.err, and, opening and closing files is expensive. For this purpose, you should only do it once per program. Otherwise, there's nothing that strikes me as obviously wrong, although you don't need fs.close(); after ps.close(); Maybe there's no text associated with getMessage() for the error? Try writing another string as well. HTH, 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: <MWalter@xxxxxxxxxxxxxxx> To: "Joe Sam Shirah" <jshirah@xxxxxxxxxxxxx> Sent: Wednesday, June 08, 2005 2:15 PM Subject: Re: Trying to get output from System.out. > It makes sense, but I can't get it to work. Here's what I've done playing > with this: > > public class WorkbookObject { > > public HSSFWorkbook getWorkbookHandle (String pathToFile) > { > > try { > FileInputStream fs = new FileInputStream(pathToFile); > POIFSFileSystem pfs = new POIFSFileSystem(fs); > HSSFWorkbook wb = new HSSFWorkbook(pfs); > fs.close(); > String tempString = "This Worked"; > writeErrorLog(tempString); > return wb; > > } > catch (Exception e){ > writeErrorLog(e.getMessage()); > return null; > } > } > > private void writeErrorLog (String error) > { > try { > String errorFileString = "/javalog/myErrors.log"; > FileOutputStream fs = new > FileOutputStream(errorFileString,true); > PrintStream ps = new PrintStream(fs); > ps.println(error); > ps.close(); > fs.close(); > } > catch (Exception ioe){ > > } > } > } > > > I get nothing in myErrors.log > > Obviously I'm a Java Rookie. Again this is being called from RPG. > > Thanks, > > Mark > > Mark D. Walter > Senior Programmer/Analyst > CCX, Inc. > mwalter@xxxxxxxxxx > http://www.ccxinc.com >
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.