Coming Soon... Local Variables in Managed COBOL

1 Likes

Let’s start with a simple example.

Declaring Local Variables

Today variables are declared in the local-storage section of a method:

In the next release of Visual COBOL you will be able to declare them within the procedure division body of your method.

Optionally, you will be able to assign a value to the variable during declaration :

 

The same principle applies to framework types. For example, declaring the .NET Class Library structure System.DateTime.

and again, optionally a value can be assigned on declaration:

    

 

Declaration of Iteration Variables

or

In the current product, the variables i and s have to be declared in the local-storage section of the method. But as shown above, in the next release, the iteration variables can be declared within the scope of the iterator.

Declaration of Exception Variables

Likewise, currently the exception variable e has to be declared in local-storage, but in the next release it can be delcared at point of use.

Scope

The scope of any in-line local variable is from the point of declaration until the end of the innermost containing block, where paragraphs, sections and the whole method are considered to be blocks.

NB. This new syntax will be available in Managed COBOL only.

And finally...

Your feedback is welcome.

 

Labels:

Announcement
Comment List
  • Just used some [paragraph-level]-scoped declared local variables today and proved to myself that the scope is the containing paragraph, as I had the same name declared within the same method but in another paragraph.  Although I decided to change the name (for the developer's sake).

    原文
    この翻訳を評価してください
    いただいたフィードバックは Google 翻訳の改善に役立てさせていただきます