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.
Re: Calling dll/exe program from AS400 -- You can't run a DLL or EXE under IBM i (aka OS/400). They are Windows programs that can only run on Windows. With appropriate set-up, you can call a Windows program over a network. However, unlike i, when Windows passes a parameter to a program, it's inpu.
Hope this helps, Curt. 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.
I have 2 ideas for you that have worked for me in the past. I'm normally a VB guy, so I can't give you precise C# code, but I can tell you exactly what you need to do and it's really simple. First off, if you're using ODBC and using SQL you can simply do a SQL CALL( ). SQL in the iSeries allows you do a call statement. The Call statement can call any RPG, CL, Cobol, CLLE, RPGLE, etc.
That's on the 400. You have the option to wait for an answer or to just do the call and exit. The SQL Call statement can also call a stored procedure. In fact you could even get really sophisticated and use the call statement to create a source file, then pass in some code and then compile a program and run it. Basically you could do almost anything. The syntax is simple.
Just setup your connection like any normal SQL connection and instead of doing a select statement just do somthing like this: 'Call MyCLPgm (PARM1)' or Just 'Call MyRPGPgm' and then execute it. Simple and elegant. The other way is to do a REXEC procedure if you're running from windows. This opens a shell that executes a remote procedure call on the 400. The only thing here is that you have to have the RPC service running on the 400. This can be turned on by opening up Operations Navigator and going to the Networking section and then to TCP/IP Servers. Just start it up and leave it running.
If it's running the the windows REXEC can execute remote procedure calls to the 400. The shell program requires some SendKeys operations to it because you have log in, etc. So it's a little more cumbersome that the SQL Call Statement, but here's some VB code that I've used successfully to do the REXEC which will call any program on the 400 also.