Plex 2E

 View Only

 Calling a RPG function from C# Server Function

Garret Greene's profile image
Garret Greene posted Apr 06, 2022 05:35 PM
Hello Everyone,

I was wondering if anyone here has ever called an AS/400 function from a C# server function before?

Recently we have migrated our application from using the WINNTC serverside to using the .NET Serverside for our plex application.

However we have one customer that needs RPG functions to read tables on their IBMi machine populated by another system.

The RPG function that is meant to be called is set as RGP400 in the model, and looking at the C# code generated for the calling function Plex does seem to recognize that.
C# Server Function Source Code

However when I try to call the function it gives an object not found error. I am currently using the default RPG location in the Application Management Console, and can confirm that the connection information is correct. Any help would be appreciated.

Error on call to the RPG function
Stack Trace Logged Alongside the Error
WayneMorgan's profile image

Yes - we have a C# application making calls to RPG programs  - make sure you are generating the Interface c# interface parameters 

                        obrun = getCallMgr().getObRunnable(fnc, getObVariableGroupX("LOAIRISConnect.FNQWLXWR_ObIn"), getObVariableGroupX("LOAIRISConnect.FNQWLXWR_ObOut"), "LOAIRISConnect.FNQWLXWR_ObFnc", "API", "RPG400", "" );
                        if(obrun != null)

Build a code library and include all the RPG programs that you call and it will include the interface defenition