If you don't want QSH flashing with messages sent by System.out.printxx
when calling Java from RPG you can use following solution by redirecting 
to a log file. No flashing occurs (at least when I used my example) when calling
the RPG2JAVA2 program. You could control the redirection by an extra parameter
when calling your methods. (or use a Properties file, ...)

kind regards,

Geert Van Landeghem
Reynders Etiketten NV
Tel: 03/460.32.81
GSM: 0477/75.95.33

import java.text.*;
import java.util.*;

public class DateDemo
  public static void main(String args[])

  public static void printDemo() {
    try {
      // Redirecting System.out to a log file.
      System.setOut(new PrintStream(new 
    catch(Exception e) {
    Date curDate = new Date();
    DateFormat df;

    df = DateFormat.getDateInstance(DateFormat.SHORT, Locale.US);
    System.out.println("United States  : " + df.format(curDate));

    df = DateFormat.getDateInstance(DateFormat.MEDIUM, Locale.UK);
    System.out.println("United Kingdom : " + df.format(curDate));

    df = DateFormat.getDateInstance(DateFormat.LONG, Locale.FRANCE);
    System.out.println("France         : " + df.format(curDate));

    df = DateFormat.getDateInstance(DateFormat.FULL, Locale.GERMANY);
    System.out.println("Germany        : " + df.format(curDate));

H dftactgrp(*no) actgrp(*new)
 * Prototype for printDemo
D printDemo       PR                  ExtProc(*JAVA
D                                     :'DateDemo'
D                                     :'printDemo')
D                                     static
   // Call the printDemo method.
   *Inlr = *on;

After calling RPG2JAVA
 Edit File: /home/gvl/java.txt
 Record :       1   of       4 by  10                      Column :    1     59 
by 126
 Control :

     ************Beginning of data**************
    United States  : 8/9/02
    United Kingdom : 09-Aug-02
    France         : 9 août 2002
    Germany        : Freitag, 9. August 2002
     ************End of Data********************

-----Original Message-----
From: P.Goovaerts@Clipper.Be [mailto:P.Goovaerts@Clipper.Be]
Sent: vendredi 9 août 2002 14:20
Subject: Re: STDOUT to file

This is a multipart message in MIME format.
[ Picked text/plain from multipart/alternative ]
I read through this thread already.  All examples are starting with RUNJVA
command through QSH though!  I tried an example (to redirect it) and the
result is that output from QSH itself is indeed written to a file on ifs.
I want to do this but starting from RPG, calling JAVA.  This isn't
described anywhere.

This is my procedure:
Call CL
  - sets 'classpath' environment variable
  - call RPG program using 'call' cmd
  - remove 'classpath' environment
The RPG program call's javamethod's using callp.

I found a way to redirect the output of QSH to an ifs-file (setting a
specific variable).  Then I changed the cl to test it:
Call CL
  - sets 'classpath' environment variable
  - sets 'QIBM...=FILE='mydir/myfile' variable
  - QSH CMD('ENV')
  - call RPG program using 'call' cmd
  - remove 'QIBM...=FILE='mydir/myfile' variable
  - remove 'classpath' environment

Result is that the output from the QSH-cmd is printed in 'myfile', the
output from the javamethod's are still shown on the 5250-screen.

"   I don't have problems, only challenges...  "

Patrick Goovaerts
Clipper Support nv
TEL : 0032 (0)3 5453991
GSM: 0498 610 325

From: "Jon Paris" <>
To: <>
Subject: STDOUT to file
Date: Thu, 8 Aug 2002 17:53:16 -0400

 >> Any suggestions on how to do this?

There has been a lengthy thread on this topic on the WEB400 list on this
server ( check the archives at the web site.  There are a
couple of solutions suggested there - I don't know for sure if it will
for Java based apps - but can't think of why it shouldn't.

Jon Paris

This is the Java Programming on and around the iSeries / AS400 (JAVA400-L) 
mailing list
To post a message email:
To subscribe, unsubscribe, or change list options,
or email:
Before posting, please take a moment to review the archives

This thread ...

Return to Archive home page | Return to MIDRANGE.COM home page