Created On: 06 October 2010
Problem:
In the Net Express IDE, environment variables can be set within the Project Properties window using the Application button and these environment variables will automatically be set and made available for the application during run-time.
How does one accomplish a similar task when using Visual COBOL 2010?
How does one accomplish a similar task when using Visual COBOL 2010?
Resolution:
Environment variables and run-time swicthes can be set in Visual COBOL using the app.config configuration file.
Create or open a COBOL solution or project using Visual COBOL 2010.
If the Solution Explorer window is not open then go to the View menu and select Solution Explorer, or press Ctrl Alt L to open it.
Right click on the project name in Solution Explorer and select Add->New Item and then select Application Configuration file from the list of Managed templates.
This will add the file app.config to your project.
Right click on app.config in Solution Explorer and select Edit.
This will bring up a mini editor where you can add environment variables and switches.
Add the environment variable name such as "dd_bookfile" and then the value such as "c:\\Tutorials\\WinBook\\WinFormBook\\bookfile.dat" and press the Set button.
Rebuild the solution and now when you run your application it will pick up the environment variable as though it were set in the computers environment itself.
Create or open a COBOL solution or project using Visual COBOL 2010.
If the Solution Explorer window is not open then go to the View menu and select Solution Explorer, or press Ctrl Alt L to open it.
Right click on the project name in Solution Explorer and select Add->New Item and then select Application Configuration file from the list of Managed templates.
This will add the file app.config to your project.
Right click on app.config in Solution Explorer and select Edit.
This will bring up a mini editor where you can add environment variables and switches.
Add the environment variable name such as "dd_bookfile" and then the value such as "c:\\Tutorials\\WinBook\\WinFormBook\\bookfile.dat" and press the Set button.
Rebuild the solution and now when you run your application it will pick up the environment variable as though it were set in the computers environment itself.
Old KB# 31840
#VisualCOBOL
#VisualStudio2010