RunUnitEnter Method

MicroFocus.COBOL.RuntimeServices
Associate the current thread with a RunUnit

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

public IDisposable Enter()

Return Value

Type: IDisposable
Exceptions

ExceptionCondition
ArgumentExceptionIf runUnit is either null or StopRun has been invoked.
Remarks

NOTE: This method should not be used from managed COBOL
Remarks

NOTE: This method is not needed if you are using either the Call method or using a program that has been added to the rununit
Remarks

NOTE: If the Dispose method on the returning object is not used then a memory leak will occur
Remarks

NOTE: If the use of this method is nested, you will need to ensure the nesting order is preserved otherwise the methods behavior is undefined
Examples

RunUnit myRunUnit = new RunUnit();
try
{
 using(myRunUnit.Enter())
 {
  /* Use class that requires RunUnit's */
  myCOBOLClass.staticMethod();  // this method uses features that require RunUnit's eg: OpenESQL, CALL, file handling etc..
 }
}
finally
{
 r.StopRun();
}
See Also

Reference