|
Thanks Barbara I went for the interactive option for stdout and stderr as follows: 1. ADDENVVAR ENVVAR(QIBM_USE_DESCRIPTOR_STDIO) VALUE('Y') 2. Added 2 entries to my SystemDefault.properties file: os400.stderr=file:/home/DEVMMAV/stderr.txt (error trace) os400.stdout=file:/home/DEVMMAV/stdout.txt (System.out.println) 3. ADDENVVAR ENVVAR(QIBM_RPG_JAVA_EXCP_TRACE) VALUE('Y') After running the class the .txt files were created in my directory in the IFS. I couldn't view via the IFS text Edit as the code page was wrong. Is there a way to specify this? However, I was able to read the .txt files using EDTF from a green screen command line so that worked. -----Original Message----- From: java400-l-bounces@xxxxxxxxxxxx [mailto:java400-l-bounces@xxxxxxxxxxxx] Sent: 09 August 2006 01:12 To: java400-l@xxxxxxxxxxxx Subject: Re: Error calling constructor from RPG *** WARNING : This message originates from the Internet *** "McCully, Keith (RBS Insurance)" wrote:
... I'd like to track the logic when called from RPG by adding some System.out.println markers so my question is: how can I view this output? I don't want a screen break to the Java shell but would like the output redirected to a file which could be either a QSYS physical file or a text file in the IFS. If possible I'd prefer redirection by an override in the job environment rather than amending Java source but can do that if now other way.
The easiest way to see the output is to call your RPG program in batch; the output will go to a QPRINT printer file. If you need this to be done when you call your RPG program in an interactive job, you _can_ do it without changing your Java code (see below). But it might be easier in the long run to write a logging class that you can direct to either System.out or some file or even turn off completely. Then instead of System.out.println(whatever), you can just code log(whatever). No matter how you do it, if you do any I/O in Java called from RPG, you might have to do a bit extra on the RPG side. See step 4 below. Here's the steps to see System.out.println output in methods called by RPG, without making any changes in the Java code: 1. You set the os400.stdout property to indicate which file you want. Say os400.stdout=file:/home/mydir/stdout.txt in your SystemDefaults.properties file or -Dos400.stdout=file:/home/mydir/stdout.txt; in your QIBM_RPG_JAVA_PROPERTIES environment variable. 2. You set the QIBM_USE_DESCRIPTOR_STDIO environment variable to 'Y' ==> ADDENVVAR ENVVAR(QIBM_USE_DESCRIPTOR_STDIO) VALUE('Y') 3. You have to do steps 1 and 2 before the JVM is started in your job. 4. You might also have to do something else in your RPG code. See this entire thread in the MIDRANGE-L archives: http://archive.midrange.com/midrange-l/200605/msg01505.html -- 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. The Royal Bank of Scotland plc, Registered in Scotland No. 90312. Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB Authorised and regulated by the Financial Services Authority. This e-mail message is confidential and for use by the addressee only. If the message is received by anyone other than the addressee, please return the message to the sender by replying to it and then delete the message from your computer. Internet e-mails are not necessarily secure. The Royal Bank of Scotland plc does not accept responsibility for changes made to this message after it was sent. Whilst all reasonable care has been taken to avoid the transmission of viruses, it is the responsibility of the recipient to ensure that the onward transmission, opening or use of this message and any attachments will not adversely affect its systems or data. No responsibility is accepted by The Royal Bank of Scotland plc in this regard and the recipient should carry out such virus and other checks as it considers appropriate.
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.