Page 1 of 1

Can we call an RPG program from Javascript

Posted: Thu Nov 01, 2012 1:15 pm
by rockman411
Is it possible to call an rpg program from JavaScript? Possibly using the POST command eg POST http://systemnam:port#/library/programname.pgm?

We are investigating calling an common RPG program from a link in the header.

Thanks in advance.

Russell Crawford (UK)

Re: Can we call an RPG program from Javascript

Posted: Thu Nov 01, 2012 1:33 pm
by David
If you want to call an RPGsp program directly from JavaScript (i.e. without submitting back to your RPG display file application and taking action from there), you'd need to do so with an Ajax call, and the RPG program would have to use CGI to read input from the Ajax call and to provide a response back to it.

Profound UI does include built-in JS APIs for making Ajax calls, see here:

http://www.profoundlogic.com/docs/displ ... evelopment

I'm wondering, though, if this is really what you want? What would the common program do or be used for? If you could explain a bit on what you are going for, I could advise on an approach.

Re: Can we call an RPG program from Javascript

Posted: Fri Nov 02, 2012 1:06 am
by Scott Klement
Hi Russell,

Is this related to the discussion we had about the attention key?

I remember we were discussing perhaps creating a custom start.html that had a button in the header that would be displayed on all screens. Perhaps that's where you want to call an RPG program?

But, what would this program do? Would it bring up a PUI rich display (possibly in a new tab)? Or would it return information to be displayed in the header?

Thanks!

Re: Can we call an RPG program from Javascript

Posted: Fri Nov 02, 2012 4:44 am
by rockman411
Thanks for your quick response to my query.

Scott: You're correct; this relates to the secondary menu problem that we are currently trying to decide how to make it work. We have previously been told that when the "Secondary Keyword Menu" link is pressed on our page header (see attached image), we can open a new tab and control the direction of the user's logon to our secondary menu using the Genie Macro Processing.

As an alternative to this design, could we just call an RPG program from this link which would open a new window of secondary keyword menu options (see second attached image). The window would overlay the screen the user is currently working on and allow the user to select another program.

My gut instinct tells me that this might not be feasible.


Thanks

Russell Crawford (UK)

Re: Can we call an RPG program from Javascript

Posted: Fri Nov 02, 2012 2:04 pm
by Scott Klement
You could potentially do that, but there'd be some caveats:
  • You'd need to use browser authentication rather than PUI authentication (which may be fine with you?)
  • Assuming this is a PUI rich display program you're calling from the link in the header, it would replace the display you have open, which might not be ideal. This is why we suggested opening it in a separate tab, so both the main progam and the secondary menu could remain functioning at the same time. (This is also a more modern way of doing things -- allowing multitasking.)
  • All of the items on your secondary menu would need to be rich display programs. My understanding is that they weren't -- and this is why we suggested using Genie macros, instead.
Can you tell us a bit more about how the secondary menu works? Is it a rich display app? Or a 5250 app, as I thought before? Do you want it to really want it to open in the same tab/window and replace the existing session? Or, do you like my idea of creating a new tab?

Let us know, we'd be happy to discuss further and help any way we can.