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.
Is there a way for an RPG program to 'know' if it was called from java?
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.
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.
Is there a purpose for this, or you just want to know?
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.
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