How to make the MFCOBOL Compatible with Visual COBOL?
We found some errors (such as “Not support N type in Visual Cobol “,” 114 Error”) will be faced when compile COBOL PROGRAM after replace Micro Focus Net Express to Visual COBOL,” so following 4 points need to pay attention when compile COBOL PROGRAM with Visual COBOL.
- Environment Variables
On 32 bit Windows
set path=%path%;C:\Program Files\Micro Focus\Visual COBOL 2010\bin
On 64 bit Windows
set path=%path%;C:\Program Files (x86)\Micro Focus\Visual COBOL 2010\bin64
- Microsoft Visual Studio
In Net Express 5.1, VC version is 9.0, and for Visual COBOL 2010R4, the VC version is 10.0. So we must install the right version and set the right PATH to make them work. For example:
On 32 bit Windows
call "C:\Program Files\Microsoft Visual Studio 10.0"\VC\bin\vcvars32.bat
copy "C:\Program Files\Microsoft Visual Studio 10.0"\VC\lib\oldnames.lib .
On 64 bit Windows
call "C:\Program Files (x86)\Microsoft Visual Studio 10.0"\VC\bin\amd64\vcvars64.bat
Copy "C:\Program Files (x86)\Microsoft Visual Studio 10.0"\VC\lib\amd64\oldnames.lib .
- Definement for N type
03 WK-N PIC N(50).
03 WK-5 PIC N(01).
In Net Express 5.1, the N type is defined with 152, in Visual Cobol 2010R4, it’s defined with 168. We must add a new type in MFDCI to map it. So only the new version DCI can support N type for Visual Cobol.
- FCD3 option for x32 platform
The File Control Description (FCD) is a data area which contains information about the file in use. There are two versions of the FCD, and which one is used depends on whether your COBOL development environment is running in 32-bit or 64-bit, as shown in the following table:
COBOL Development System |
FCD Used |
Mainframe Express |
FCD2 |
32-bit Visual COBOL |
FCD2 |
64-bit Visual COBOL |
FCD3 |
.NET Support within Visual COBOL |
FCD3 |
32-bit Server Express |
FCD2 or FCD3 |
64-bit Server Express |
FCD3 |
Because "FCD3" is the default options for Visual Cobol on 32bit/64bit which not same as Net express (use "FCD2" for 32bit and “FCD3 for 64bit). We need compiling with “NOFCD3” option for Visual Cobol on 32 bit OS, otherwise the 114 Error will be faced. Usage as following:
First, add following information in xfd.cfg (User can specify the path for xfd.cfg) file:
NOFCD3 CREATEXFD CALLFH “DBMAKETINTF”
Then execute cbllink command as below:
cbllink -oTEST.exe -uxfd.cfg -g -b TEST.cbl oldnames.lib dmmfcbl.lib dmdcic.lib dmapi52.lib
or
cbllink -oTEST.exe -u C:\test\xfd.cfg -g -b TEST.cbl oldnames.lib dmmfcbl.lib dmdcic.lib dmapi52.lib
In addition, we will provide a new DCI lib which uses the NOFCD3 as default option and user don’t need add any options.
cbllink -oTEST.exe -uxfd.cfg -g -b TEST.cbl oldnames.lib dmmfcbl_fcd3.lib dmdcic.lib dmapi52.lib
Note 1:
The new lib is only for 32bit platform and it’s not compatible with Net Express version (totally different data structure), so we rename the lib name to dmmfcbl_fcd3.lib.
Note 2:
If users want to build the COBOL programs to INT or GNT format, because COBOL command cannot identify the NOFCD3 option, please use new lib dmmfcbl_fcd3.lib to replace dmmfcbl.lib to build runtime to avoid the 114 Error (memory access violation). Usage as following:
Build the DBMAKERINTF.dll
cbllink -v -K -L -d -oDBMAKERINTF.dll mfcall.obj oldnames.lib dmmfcbl_fcd3.lib dmdcic.lib dmapi52.lib
Build the GNT and execute it with DBMAKERINTF.dll.
cobol test.cbl CREATEXFD CALLFH "DBMAKERINTF.dll" gnt
Version: DBMaker5.x
Product: Normal /Bundle
Platform: All