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



Wouldn't just calling the JAVA command string from within RPG via system()
or even QCMDEXC just a well in this situation?


-Bob Cozzi
www.RPGxTools.com
RPG xTools - Enjoy programming again.


-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Joe Pluta
Sent: Monday, November 14, 2005 8:03 AM
To: 'RPG programming on the AS400 / iSeries'
Subject: RE: Calling Java from RPG 

Yes and no.  When you call a Java program from the command line, you are
actually calling the static method "main".  Also, the command line
processor takes your parameter line and parses it into an array of
Strings, breaking up the line at blanks.

So, yes, you can call the routine's main method but it takes some extra
work.  You would have to create your own array of Strings to pass to the
main method.  That's not impossible, but it takes a little work,
especially since RPG doesn't handle Strings and arrays quite the same
way Java does.  There are two basic options:

1. Add a special method to the GeneratePDF class that takes a byte array
(RPG's equivalent of a String), parses it into an array of Strings, and
then calls the main method.

2. Write a utility class with a static routine that takes a byte array
and returns an array of Strings.  This you could then use whenever you
needed to call a class's main method.  In your RPG program, just pass
the byte array to the new method, and pass what it returns to the main
method of the GeneratePDF class.

Hmmm.  I like the second option.  Seems like a nice thing to have in
your toolbox.

Joe


> From: B.Quindt@xxxxxxxxxxxx
> 
> Hello,
> 
> we called a Java Program in a CL-Programm
> 
> JAVA       CLASS(com.mypgm..itext.GeneratePDF) +
>              PARM(&DIR) OUTPUT(*NONE)
> 
> &DIR is a Character String (128 A)
> 
> 
> Can I do this in an RPG Programm directly via Prototyp Call ?


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.