Page 1 of 1

Running a pc Command that relies on host Command execution

Posted: Tue Apr 17, 2012 6:04 pm
by Stuart
I have a dropdown box that is attached to a table (subfile)

There are 2 options, and one of those options needs to run both a host Command and a pc Command
The iSeries (RPG) program runs a host command to create a PDF file
The pdf file then needs to be passed as a parameter to the pc Command.
Since the pdf is being generated thru a host command, based on user selection,
and then a PC command needs to run to process the file, how can I achieve all this
with the onchange event of the drop down box? By the way, the pdf file name is variable, so I need to pass control to the RPG program to create the file, and then run a javascript (runPCCommand) that will process the command string (within a hidden field) that is created in the RPG program.

I could download a PDF creation package (such as lowagie PDFWriter), and then accomplish all thru a pc Command call, however, my employer would prefer that I use the utility that we already have on the iSeries to create the pdf,

Can all this be done with one button click? I am beginning to think that I may need 2 events, one to create the PDF, and the other event to send the file.

Re: Running a pc Command that relies on host Command execution

Posted: Thu Apr 19, 2012 9:25 am
by Brian
Stuart,

It really depends on what you are wanting to do on the PC side. If it is just to open the pdf, you could handle it one of two ways:

1. Have your program call the program to generate the PDF and then use STRPCCMD to open it for the user.

2. (My preferred method) Write a CGI program that will generate the PDF and stream it to the browser. Then your js can open a new browser tab and just call this program.


If you need to run some process on the PC against the file and are not just looking to display it, then option one is probably your best choice. It will require a trip back to the server to do it however.