Midrange News for the IBM i Community


Posted by: renojim
RPG call from java
has no ratings.
Published: 22 Jul 2016
Revised: 03 Aug 2016 - 265 days ago
Last viewed on: 24 Apr 2017 (557 views) 

Using IBM i? Need to create Excel, CSV, HTML, JSON, PDF, SPOOL reports? Learn more about the fastest and least expensive tool for the job: SQL iQuery.

RPG call from java Published by: renojim on 22 Jul 2016 view comments(5)

Is there a way for an RPG program to 'know' if it was called from java?

Return to midrangenews.com home page.
Sort Ascend | Descend

COMMENTS

(Sign in to Post a Comment)
Posted by: bobcozzi
Site Admin ****
Chicagoland
Comment on: RPG call from java
Posted: 9 months 2 days 4 hours 41 minutes ago

Hmm... good question. I don't like guessing, but I would expect you would need to check the call stack or if there's an environment switch that gets set by IBM when Java is in the stack. But none of those would prove your program was evoked by Java. Sorry I couldn't be of more help.

Posted by: Ringer
Premium member *
Comment on: RPG call from java
Posted: 8 months 29 days 2 hours 35 minutes ago

The JDBC SQL CLI CALL would probably be handled by a QSQSRVR job in subsystem QSYSWRK (same for PHP) but I think that behavior can be overridden to a different SBS. Might be a message in that job log but really I don't know! Post back if you find a way. 

Posted by: DaleB
Premium member *
Reading, PA
Comment on: RPG call from java
Posted: 8 months 23 days 10 hours 6 minutes ago

Is there a purpose for this, or you just want to know?

Posted by: renojim
Premium member *
Comment on: RPG call from java
Posted: 8 months 22 days 1 hours 19 minutes ago

I have to put a portlet front end on a large rpg/green screen part of an accouting system. Trying to find the easiest way to do it, 'cause as they say, "give a lazy man a hard job, and he'll find an easy way to do it".  So I was thinking maybe I could modify the existing rpg pgms to, if called from cl/rpg as they currently are, to carry on normally, but if called from java, do what they do and return the results to the calling java pgm and skip the green screen display. Easier said than done, of course, but in this case maybe worth looking at.

Posted by: Ringer
Premium member *
Comment on: RPG call from java
Posted: 8 months 21 days 22 hours 43 minutes ago

If called from Java, then probably using a QSQSRVR or QZDASOINIT job so running as BATCH program, not interactive. That might be your clue. Put a USROPN on the WORKSTN and don't open it if batch. 

Ringer