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



"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


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.