Visual COBOL enables you to rename variables, section and paragraph names in native COBOL as well as of identifiers in managed COBOL.
To rename:
This highlights all occurrences of the variable in the editor and opens the Rename widget.
If you checked Preview, this now shows a list of all files and occurrences of the variable that will be renamed.
After applying any of the changes, you can click Edit > Undo or Edit > Global Undo *Global Rename to revert them.
To rename class files in managed projects from Solution Explorer:
This opens the Suggested Rename dialog box offering to also rename all instances of the class name you are changing in the code.
You can specify a new name which is also a COBOL reserved word. Visual COBOL inserts such names in the code and escapes them with a # as a prefix. For example, if you want to rename your variable or identifier with the word name, renaming replaces the old name with #name.
An escape character is not needed if the identifier is referenced in the code through the :: notation. The following example shows a class in which two variables have been given new names that are COBOL reserved words. The code references the variables directly and with :::
class-id SomeClass. working-storage section. 01 #name binary-long. 01 #accept binary-long. 01 var-a binary-long. method-id SomeMethod. set #name to 0 set self::accept to 0 set var-a to 0 set self::var-a to 0 declare x as type SomeClass. set x::name to 0 end method. end class.
When you are exposing your COBOL applications to other languages, the escape character, #, is not taken into account. For example, from C# you can access the two variables as name and accept.
The following restrictions apply to rename refactoring:
The following restrictions apply to native COBOL only:
The following restrictions apply to managed COBOL only: