Hello Anand:
Do not set the COBDIR environment variable to indicate the location of a cobol.dir file, because COBDIR is supposed to indicate the place where the whole Micro Focus product is installed. If you set COBDIR to a place other than where the product is installed, it will cause undefined behavior.
A file COBOL.dir will be recognized in the current directory, as you know from experience. COBOL.dir will also be recognized if it is placed in %COBDIR%\etc, in other words, the \etc sub-folder of the place where the product is installed.
To solve this problem, place your COBOL.dir file in the \etc sub-folder of the place where the product is installed.
Here is the default product install location (though this default may potentially be overridden when a person installs the product):
C:\Program Files (x86)\Micro Focus\<product-name>
for example, in the case where the Micro Focus product happens to be Enterprise Developer:
C:\Program Files (x86)\Micro Focus\Enterprise Developer
So in the above example, place your COBOL.dir file in the folder:
C:\Program Files (x86)\Micro Focus\Enterprise Developer\etc
To discover the product install location, and to discover the default and proper setting for the COBDIR environment variable, use the Windows Start Menu > All Products > Micro Focus > Tools > Command Prompt to open a command prompt window, then enter:
echo %COBDIR%
For example (in the case where the Micro Focus product is Enterprise Developer):
Start > All Programs > Micro Focus Enterprise Developer > Tools > Enterprise Developer Command Prompt (32-bit)
echo %COBDIR%
Place your COBOL.dir file in %COBDIR%\etc.
See also this link into the documentation that describes other ways of setting compiler directives as an alternative to COBOL.dir:
documentation.microfocus.com/.../GUID-D27780EB-053B-4748-8F5D-155C10149A71.html