Compiling COBOL Locally

Compiling COBOL locally can save you considerable time during the development/troubleshooting stage.

In order to compile COBOL locally you will need to have the MicroFocus NetExpress COBOL compiler installed on your machine. This requires a license. Alternatively you can try the Microfocus NetExpress Personal COBOL compiler (note this has a restriction where source files need to be <= 2200 lines).

The steps for compiling COBOL locally are:

  • Install Microfocus NetExpress
  • Configure the %COBROOT% system variable to point to the Microfocus NetExpress compiler path
  • Copy the batch files for compiling COBOLs from %PS_HOME%\src\cbl\win32 to your C:\WINDOWS directory
  • Copy all COBOLs to a local directory, for example C:\COBOL
  • Compile COBOLs using the CBLMAKE.BAT batch script

When you install Microfocus, put it in a directory with no spaces. I like to use something like C:\NetExpress rather than the default directory. This is just a preference, I'm not sure if it causes any issues.

You will need create a system environment variable called COBROOT. This points to the Base directory of your Microfocus NetExpress installation. For example, C:\NetExpress\Base.

Browse to your PeopleSoft File Server and copy the following files from %PS_HOME%\src\cbl\win32 to your C:\WINDOWS directory:

  • ASCII.DIR
  • CBLRULE.BAT
  • CBLMAKE.BAT
  • CBLCRINT.BAT
  • CBLCD.BAT
  • EBCDIC.DIR

Copying them to your WINDOWS directory lets you run them from anywhere as they are automatically in the system path.

Copy all the COBOLs from your PeopleSoft file server to a local directory (C:\COBOL).

Command prompt to the local directory and attempt to compile a program (e.g. the delivered PTPDBTST program) by issuing the command (note that you drop the .cbl extension):

$ cblmake PTPDBTST

Hopefully it compiles for you. If not, you may have forgot to set the COBROOT environment variable. Make sure you set this first.

To build all cobols, run the following command (in Windows) from %PS_HOME%\setup:

$ cblbld.bat C: \temp

This will copy source COBOLs from %PS_HOME%\src\cbl\base to C:\Temp (or whatever drive and directory you specify), compile them and put them in a directory named %PS_HOME%\CBLBIN(A/E/U) where A=Ansi, E=EBCDIC and U=Unicode.

After the build, the build log will be displayed. You can also view the build log by opening the file CBLBLD.LOG which will be located in the compile directory (e.g. C:\Temp).

If you find the following throughout your log file:

...
Creating error listing (COBOL1.LIS)
Creating error listing (COBOL2.LIS)
Creating error listing (COBOL3.LIS)
...

It may mean your Microfocus NetExpress license has expired. Check by starting Microfocus NetExpress. COBOLs will not compile on Windows systems when the license has expired.

This white paper from My Oracle Support provides a heap of useful information too (ID 835487.1).

Troubleshooting

Compiling gives the following error:

Application Program Failed                                                       
Action Type     : SQL CONNEC
In Pgm Section  : SQLRT:GG100 SQL-CONNECT
With Return Code: 9989
Error Message   : SQLRT: Operator ID not allowed to submit COBOL from client

This can be caused by having %PS_HOME%\bin\client\winx86\ in your system path. Remove this location from your system path and try again.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License