A guide that provides a basic introduction to Object-Oriented Programming (OOP) for COBOL developers,
An Introduction to Object-Oriented Programming for COBOL Developers, with examples is now available from the
Product Documentation section on the
Micro FocusSupportLine Web site -
click here to download it.
Procedural Multi-Output Project type
A new .NET managed project template, Procedural Multi-Output Project, is now available. The project compiles procedural programs to individual managed assemblies or executables as opposed to the standard managed project templates that produce a single assembly. This project type is useful when you are moving existing procedural applications that consist of multiple programs to
Visual COBOL and to managed code. When calling a subprogram, the COBOL run-time system can locate the assembly using the name of the called program which will match the assembly file name. In this case, the assembly does not have to be preloaded. See
Types of COBOL Project Templates for more details and for a list of the limitations of this project type.
Named and optional parameters
Two new types of parameter have been introduced for use during method invocation:
Named parameters
As part of the invocation expression, you can define a value for a parameter named in the method definition. The named argument must be specified after any positional arguments, and must not correspond to any of those preceding arguments.
Optional parameters
Optional parameters are parameters defined with a default value in the procedure division header of the invoked method. If none of the arguments passed in during invocation correspond to this parameter, the default value is used in the method; if an argument does correspond, the value that was passed in is used.
Delegates and events
A number of new features have been added that relate to delegates and events:
Note: Some of these features were also available in previous versions of
Visual COBOL.
The ATTACH and DETACH statements
Use these statements to attach or detach a delegate, method group or an anonymous method to or from an event.
The RUN statement
Use this statement to invoke a delegate once it has been created.
Combining delegates
Use the '+' operator to add a method group, anonymous method or another delegate to a delegate, and use the '-' operator to remove a method or another delegate from a delegate.
Method groups conversions
Use the METHOD keyword to specify a compatible method from a method group, and convert it to a delegate.