ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Suppress run-time display when prototyping and calling Java from RPGLE

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Suppress run-time display when prototyping and calling Java from RPGLE

    Hi,

    I am prototyping and calling some Java methods in some online as well as batch RPGLE programs.

    In the online RPGLE program, a terminal screen comes up as soon as the java method is invked showing some messages. I need to eliminate this screen.
    In the batch RPGLE program, all these messages are directed to spooled file QPRINT it seems. And I need to avoid this mesagges going to QPRINT also. In fact I need to either discard these messages or redirect them to some other file.

    I tried these but it didn't work.

    ADDENVVAR ENVVAR(QIBM_QSH_CMD_OUTPUT) VALUE(NONE)

    ADDENVVAR ENVVAR(QIBM_QSH_CMD_OUTPUT)VALUE('FILE=/mydirectory/QSHELL_output') LEVEL(*JOB)

    I wonder why setting the above environment variables didn't work. Is it because calling java from RPGLE does not invoke QSH at all. If so, then is there any other environment variable which can be set to some value to discard or re-direct messages when calling java from RPGLE.

    Looking forward to replies. Any help on this will be appreciated.

    Thanks,
    Subha P.

  • #2
    Re: Suppress run-time display when prototyping and calling Java from RPGLE

    Hi,

    I could avoid the screen from flashing when java is called from RPGLE in my online programs by adding the following environment variables.

    ADDENVVAR ENVVAR(QIBM_RPG_JAVA_PROPERTIES) +
    VALUE('-Dos400.stderr=file:STDERR.TXT;-Dos400.stdout=file:STDOUT.TXT;')

    ADDENVVAR ENVVAR(QIBM_USE_DESCRIPTOR_STDIO) VALUE('Y')

    But in the RPGLE programs run in batch, the messages (same as in the screen in online programs) still go to a spooled file called QPRINT. How can I avoid this because in my programs QPRINT is used later to store some other stuff and print them using the Office Visio/400 CL command PRTDOC and this stuff to be printed in QPRINT file gets damaged because it is overwritten by the stdout messages from java program.

    Thanks,
    Subha P.

    Comment


    • #3
      Re: Suppress run-time display when prototyping and calling Java from RPGLE

      Remove all System.out.println from your program. If you need to debug your program look into using Log4j.
      Last edited by kpmac; January 23, 2007, 10:16 AM.
      Predictions are usually difficult, especially about the future. ~Yogi Berra

      Vertical Software Systems
      VSS.biz

      Comment


      • #4
        Re: Suppress run-time display when prototyping and calling Java from RPGLE

        Hi,

        I have removed all System.out.println statements from the java program. Now there are no messages to be printed in QPRINT. Still I am getting an error in the PRTDOC statement as follows.

        Message . . . . : OFCFFFD received by ABC101 at 17400. (C D I R)
        Cause . . . . . : Control language (CL) program ABC101 in library XYZLIB
        detected an error at statement number 17400. Message text for OFCFFFD is:
        Damaged object found.

        How is the document in QPRINT getting damaged now, when there are no java messages directed to QPRINT? Earlier I could find a spooled file QPRINT in the list of spooled files for my batch job which had stored the messages from java program after overwriting the original document, but now the QPRINT is missing from the spool.
        If I remove the call to the java program, then the OFCFFFD error goes and the document to be printed is found in QPRINT.

        Thanks,
        Subha P.
        Last edited by subhashree; February 1, 2007, 10:44 PM. Reason: spelling mistake

        Comment


        • #5
          Re: Suppress run-time display when prototyping and calling Java from RPGLE

          I can't tell from the message but are you sure this error comes from the java prototype?

          To answer your question from above QSH is not used in prototyped calls (JNI). When you run the program interactively the screen you are seeing is the console.

          What is your program doing?
          Predictions are usually difficult, especially about the future. ~Yogi Berra

          Vertical Software Systems
          VSS.biz

          Comment


          • #6
            Re: Suppress run-time display when prototyping and calling Java from RPGLE

            Yes I am sure the document is getting damaged only after I changed the program to call the Java Methods. If I comment out the call to java program, then I am not getting the "OFCFFFD: Damaged Object Found error" on the PRTDOC command.

            As you have said "To answer your question from above QSH is not used in prototyped calls (JNI). When you run the program interactively the screen you are seeing is the console." So when we make prototyped calls to java from batch RPGLE programs, then where are the java display messages redirected to because the console screen does not pop up in batch programs. When we do a SBMJOB and call a java program from QSH, then all display messages are redirected to QPRINT.
            Last edited by subhashree; February 4, 2007, 11:33 PM.

            Comment


            • #7
              Re: Suppress run-time display when prototyping and calling Java from RPGLE

              When you a batch program the output is redirected to a spooled file in QPRINT.
              When you run a program in QSH the ouput is redirected to the console of QSH.

              Did you make any other changes?

              It appears that your program worked before you removed the System.out.println's. What was changed between removing the ouput and running the modified program?

              I do not know what your program is doing and will not be able to help you without a code sample.
              Predictions are usually difficult, especially about the future. ~Yogi Berra

              Vertical Software Systems
              VSS.biz

              Comment


              • #8
                Re: Suppress run-time display when prototyping and calling Java from RPGLE

                I am making some prototyped calls to java programs from RPGLE program and these RPGLE program is called from other RPG and CL programs. Some of these RPG/CL programs, are run in batch and in one such CL program I have a PRTDOC command which prints some document after making a call to RPGLE program. Ever since I have added the prototyped call to the java methods in the RPGLE program, this PRTDOC command is failing with the following message.

                Message . . . . : OFCFFFD received by ABC101 at 17400. (C D I R)
                Cause . . . . . : Control language (CL) program LTC101 in library XYZLIB
                detected an error at statement number 17400. Message text for OFCFFFD is:
                Damaged object found.

                If I remove the prototyped call to java program from the RPGLE program, then the OFCFFFD error is also eliminated and the PRTDOC command in the CL is executed correctly.

                Comment


                • #9
                  Re: Suppress run-time display when prototyping and calling Java from RPGLE

                  Thanks that really clears things up!

                  Looks like you are on your own with this one.

                  I cannot help you if you d not post some code.
                  Predictions are usually difficult, especially about the future. ~Yogi Berra

                  Vertical Software Systems
                  VSS.biz

                  Comment

                  Working...
                  X