Highlighted
Absent Member.
Absent Member.
1887 views

Visual COBOL Environment Variables Not Working on Linux

Jump to solution

I use tutorial project - 03_01_Simple_structure.

If I run it in Visual COBOL on Windows, Environment Variables are working, COBOL executable code can access them in the console windows.

But I run the same code with correct Environment Variables Path on RED HAT Enterprise. The executable code complains not finding them. I need to copy the PATH into the code to replace the Environment Variables, that works !

Could someone help me to confirm that -

That might be the issue on my Linux machine only,  or that might be a little bug with Visual COBOL tools on LINUX.

Appreciated.

0 Likes
1 Solution

Accepted Solutions
Highlighted
Absent Member.
Absent Member.

RE: Visual COBOL Environment Variables Not Working on Linux

Jump to solution

Thank you, Blair

   I tried your instruction,  it still did not work for me.  I found the reason for that issue:

In COBOL code, no matter I use Upper or Low case for Environment Variable.  The COBOL executable is always looking for UPPER CASE variable, e.g.

Select InFile assign datain.   --- > at run-time, COBOL expects DATAIN (not datain)

On Windows System, it does not matter if the environment variable is defined as

datain   = PATH to the file

or

DATAIN = PATH to the file

Because Windows is case-insensitive OS, but on LINUX, datain and DATAIN mean 2 things.

I think it would be better -- in Visual COBOL, automatically convert any environment variable with all CAPITAL letters. (force to use UPPER case at design time, or convert to UPPER case at run-time, either is good)

With that way, developer can easily move COBOL project between Windows and Linux.]

Thank you again for the help.

-Jack

View solution in original post

0 Likes
4 Replies
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: Visual COBOL Environment Variables Not Working on Linux

Jump to solution

Hello jzhang18,

I have an idea why this may be happening. By default, when you first run or debug a program in Visual COBOL for Eclipse, a new "Run Configuration" or "Debug Configuration" is automatically created. This configuration will inherit the Environment settings you've specified inside of Project Properties, but *only if you've set the Project Property for the environment before you first run the program*.  Otherwise, you'll need to either:

1) Modify the existing Run or Debug configuration to define the environment variable(s) in the Environment tab

2) Create a new Run or Debug configuration, now that the Project Settings specify the Environment variable. The Environment setting will be automatically added to the new runtime configuration. In this case, you need to be sure to *use* the new configuration when you run or debug your program.

Please see the following link for information about setting environment variables in a Run or Debug configuration:

documentation.microfocus.com/.../GUID-A966EA64-54AF-4963-BE78-75744DB6F9F8.html

Blair McDonald

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: Visual COBOL Environment Variables Not Working on Linux

Jump to solution

Corrected above answer to remove references to "Build Configuration" which do not apply here.

Blair McDonald

0 Likes
Highlighted
Absent Member.
Absent Member.

RE: Visual COBOL Environment Variables Not Working on Linux

Jump to solution

Thank you, Blair

   I tried your instruction,  it still did not work for me.  I found the reason for that issue:

In COBOL code, no matter I use Upper or Low case for Environment Variable.  The COBOL executable is always looking for UPPER CASE variable, e.g.

Select InFile assign datain.   --- > at run-time, COBOL expects DATAIN (not datain)

On Windows System, it does not matter if the environment variable is defined as

datain   = PATH to the file

or

DATAIN = PATH to the file

Because Windows is case-insensitive OS, but on LINUX, datain and DATAIN mean 2 things.

I think it would be better -- in Visual COBOL, automatically convert any environment variable with all CAPITAL letters. (force to use UPPER case at design time, or convert to UPPER case at run-time, either is good)

With that way, developer can easily move COBOL project between Windows and Linux.]

Thank you again for the help.

-Jack

View solution in original post

0 Likes
Highlighted
Absent Member.
Absent Member.

RE: Visual COBOL Environment Variables Not Working on Linux

Jump to solution

In the next version of Visual COBOL,  I would like to see this implementation:

When user adds the environment variables,  as normal:

When he clicks Apply or OK button,   the environment variables become:

It solves the issue for  Visual COBOL on Linux, and it works fine on Windows.

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.