RunUnitCommandLine Property

MicroFocus.COBOL.RuntimeServices
Sets the command line for the programs executing in the RunUnit

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

public string CommandLine { set; }

Property Value

Type: String

Implements

IRunUnitCommandLine
Exceptions

ExceptionCondition
ArgumentExceptionIf StopRun method has already been invoked.
Examples

The following example shows a command line being set up for the RunUnit. An instance of a RunUnit called MyRunUnit is created, the command line is set up and the program cline.cbl is called within that RunUnit. Finally the RunUnit is terminated with the StopRun method().

C#:

using MicroFocus.COBOL.RuntimeServices;

public class UseCline
{
   static void Main(string[] args)
   {    
       RunUnit myRunUnit = new RunUnit();
       try
       {
          myRunUnit.CommandLine = 
               "Hello from C# (via the CommandLine property)";
          myRunUnit.Call("cline");
       }
       finally
       {
         myRunUnit.StopRun();
       }
   }
}

COBOL:

cobol
program-id. useCline as "Cline".
 environment division.
 configuration section.
 repository.
   class cls-RunUnit as "MicroFocus.COBOL.RuntimeServices.RunUnit" 
   .
 data division.
 working-storage section.
 01 myRunUnit object reference cls-RunUnit.

 procedure division.
 invoke cls-RunUnit "new" returning MyRunUnit
    set myRunUnit::"CommandLine" to 
         "Hello from COBOL (via the CommandLine property)"
 try
    invoke myRunUnit::"Call"("cline")
 finally
    invoke myRunUnit::"StopRun"()
 .
 end program useCline.

The called program cline.cbl is:

cobol
working-storage section.
01 cmd-line       pic x(80).
procedure division.
  accept cmd-line from command-line
  display cmd-line
  exit program.
See Also

Reference