UPDATE! The community will be go into read-only on April 19, 8am Pacific in preparation for migration on April 21. Read more.
UPDATE! The community will be go into read-only on April 19, 8am Pacific in preparation for migration on April 21.Read more.
Admiral
Admiral
237 views

Convert C# to Cobol - this.xpto > self::xpto

Jump to solution

 

Good Morning:
I am trying to adapt a part of a C# program (Forms) for Cobol and there is a part that I don't understand.

For example:
                this.Amount=operation.Amount;
                this.Date=operation.Date;
                this.Destination=operation.Destination;
is converted to:
               set self::Amount to operation::Amount
               set self::Date to operation::Date
               set self::Destination to operation::Destination

What is the "this." statement and how to use the converted statement "self ::".

Thanks
Alberto Ferraz

 

0 Likes
1 Solution

Accepted Solutions
Admiral
Admiral

Hi Chris,

As i understand it, "self ::" replaces the screen name.

For example, in the program "TestXpto" we had the field "TextValue". Instead of using the TextXpto :: TextValue field, we use self :: TextValue.

Thanks

Best regards

View solution in original post

0 Likes
2 Replies
Micro Focus Expert
Micro Focus Expert

There is a definition of the "this" keyword in C# here.

In a nutshell it means:

The this keyword refers to the current instance of the class and is also used as a modifier of the first parameter of an extension method.

"self" is the COBOL equivalent to "this"

For  example within a Windows Forms application it refers to the current running form. If you have two forms active, form1 and form2 then when referenced within the form1 object "self" refers to the form1 object and when referenced within form2 it refers to the form2 object.

 

0 Likes
Admiral
Admiral

Hi Chris,

As i understand it, "self ::" replaces the screen name.

For example, in the program "TestXpto" we had the field "TextValue". Instead of using the TextXpto :: TextValue field, we use self :: TextValue.

Thanks

Best regards

View solution in original post

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.