RunUnitGetInstance Method (Type)

MicroFocus.COBOL.RuntimeServices
Given a Type object return the programs instance if the RunUnit knows about it. If an instance does not already exist this call will return null.

Namespace:  MicroFocus.COBOL.RuntimeServices
Assembly:  MicroFocus.COBOL.RuntimeServices (in MicroFocus.COBOL.RuntimeServices.dll) Version: 1.2.3.4
Syntax

[CLSCompliantAttribute(false)]
public IObjectControl GetInstance(
	Type programType
)

Parameters

programType
Type: SystemType
The type of the program to construct.

Return Value

Type: IObjectControl
An instance of programType or null.

Implements

IRunUnitGetInstance(Type)
Examples

// Create a run unit for the called COBOL program
var myRunUnit = new MicroFocus.COBOL.RuntimeServices.RunUnit();
var Result = 0;

try
{
  // Call the COBOL method and implicitly instantiate it
  Result = myRunUnit.Call("Program1", "Jim", 10);

  //... sometime later..
  var myProgram1 = myRunUnit.GetInstance(typeof(Program1)) as Program1;
  myProgram1.Program1("Dobson again", 36);
}
finally
{
   // Destroy the run unit
   myRunUnit.StopRun();
}
See Also

Reference