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 - 2821 days ago
Last viewed on: 23 Apr 2024 (2959 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: 7 years 9 months 1 days 9 hours 48 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: 7 years 8 months 28 days 7 hours 42 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: 7 years 8 months 22 days 15 hours 13 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: 7 years 8 months 21 days 6 hours 26 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: 7 years 8 months 21 days 3 hours 50 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