Calling a RPG Program on IBM iSeries/AS400

Does anyone have an idea how to call an RPG Program  API on AS400/iSeries.
I'm no expert in AS400 but I do have lots of experience with other mainframes.  The first question you need to ask yourself is what is the use case for this.  RPG programs, generally speaking, are not well suited to being called by an outside entity.  If what you are really trying to do is get at the data that the RPG program uses, you would have a much better chance at success.  For example, let's assume that the RPG program works against a DB2 database.  It just so happens that there is a component in Forge that will let you access this database, assuming appropriate configuration on the AS400 to allow external access.  Once you can read the database in Outsystems the rest is easy.

Hope this helps,
HI Curt, Thanks for your reply. Unfortunetly DB2 database cannot be access, the only way to access the data is to call an RPG program.

It is an old system, and I am trying to get data from it with not much options.
I only see the option to built an extension in .NET to call the RPG program. I was hoping someone might have done something like that before.
So even if you create a .Net extension, how are you getting to the mainframe and specifically that RPG program, Web Services (SOAP, REST) or is there a specific API that is documented someplace?  Generally mainframe systems are very protective of outside access so you really need to determine how you can communicate with the AS400 to determine what the best solution would be. Good luck!
Should be Something like this.

This topic interests me greatly.

I enjoyed

But disagree with the approach of going straight to DB2 by passing the business logic in the form of RPG functions, Yes if you are lucky that the ibmi application was built using data-centric principles then cool, but most likely the application was written program centrically and you cant bypass the rpg tier.

So how can you invoke the RPG tier? Publish using Integrated Web Services for IBM i but is there a way of consuming RPG functions.....

Hi George,

I have done this in the past through an extension in Integration Studio.
IBM iAccess client provides a CWBX library that you can use to call RPG Programs, it is available for C# and Java. Similar to what is described here
You will need to use that dll or jar and create an extension in Integration Studio to call RPGs.

Hi Roland,

Many thanks for your reply and a useful option to leverage existing ibmi functionality.

After further thought feel its best not to expose this way but through IBMi Integrated Web Server as Rest/SOAP services. 

But still an option all the same that could be offered.

IBM i and .Net Connectivity With XMLSERVICE