Hello,
based on your answer I have tested two ways
int SExtUebergabeLen = 815;
SExtUebergabe sExtUebergabe = new SExtUebergabe();
int SUservgIoLen = 4711;
SUservgIo sUservgIo = new SUservgIo();
RunUnit runUnit = new RunUnit();
XUSERVG xuservg = (XUSERVG) getCallable(); // creates an instance of XUSERVG
runUnit.Add((IObjectControl) xuservg);
retValue = xuservg.XUSERVG(SExtUebergabeLen, sExtUebergabe, SUservgIoLen, sUservgIo);
This works like a charm but runUnit.Call is not working (or at least I do not understand how to use it) so :
int SExtUebergabeLen = 815;
SExtUebergabe sExtUebergabe = new SExtUebergabe();
int SUservgIoLen = 4711;
SUservgIo sUservgIo = new SUservgIo();
RunUnit runUnit = new RunUnit(); // XUSERVG is not instanciated and added to the RunUnit
Object params [] = {SExtUebergabeLen, sExtUebergabe, SUservgIoLen, sUservgIo};
retValue = runUnit.Call("de.lv1871.cobol.XUSERVG", params);
Is resulting in the exception:
com.microfocus.cobol.program.COBOLProgramCallException: 181 Invalid parameter error [package de.lv1871.cobol.XUSERVG]
(argument type mismatch)
at com.microfocus.cobol.program.ProcedurePointer.callReturningObject(Unknown Source)
at com.microfocus.cobol.program.ProcedurePointer.callReturningObject(Unknown Source)
at com.microfocus.cobol.runtime.core.RuntimeSessionManager.staticExecuteObject(Unknown Source)
at com.microfocus.cobol.runtime.core.RuntimeSessionManager.staticExecute(Unknown Source)
at com.microfocus.cobol.runtime.core.RuntimeSessionManager.execute(Unknown Source)
at com.microfocus.cobol.runtimeservices.RunUnit.Call(Unknown Source)
at de.lv1871.cobol.javastubs.Uservg.callProgram(Uservg.java:46)
......
runUnit.Call would be much easier for me. I have LOTS of Calls to Cobol and I could make great use of the more generic Method "Call".
Kind regards