COBOL

Migrating COBOL DMS

There are two parts to migrating a COBOL DMS (data mover script):

  1. Migrate the data mover script to %PS_HOME%/src/cbl
  2. Run the data mover script in Data mover

Migrating the script ensures that the correct version of the file exists in your target environment. Running the data mover script updates the COBOL SQL statements table PS_SQLSTMT_TBL with the latest version of the data mover script.

It is the PS_SQLSTMT_TBL that stores the version of the SQL statements run by a COBOL process. It is good pratice to have the DMS script files in sync with the version in the SQL statements table to avoid confusion.

When comparing versions of SQL statements (e.g. for comparing patches) use the PS_SQLSTMT_TBL as your definitive source, as the version in %PS_HOME%/src/cbl/ may not be same!

COBOL SQL Trace

This article explains how to enable a COBOL SQL trace on a COBOL process definition.

First, determine the COBOL SQL process parameters by navigating to:

PeopleTools > Process Scheduler > Process Types

Open the COBOL SQL process appropriate for your operating system and database platform (e.g. UNIX and Oracle).

cobol-sql-parameter-list.png

Copy the text in the Parameter List excluding %%PRCSNAME%% (not required).

%%DBTYPE%%/%%DBNAME%%/%%OPRID%%/%%OPRPSWD%%/%%RUNCNTLID%%/%%INSTANCE%%//%%DBFLAG%%

Next, override the Process Definition parameter list for the COBOL you want to trace by navigating to:

PeopleTools > Process Scheduler > Processes

Open your COBOL process definition. In this example, I'm using the PTPDBTST simple COBOL test program delivered with PeopleTools. In the override options, set the parameter list option to override.

Paste the parameter list you copied into here, but make one small change. Just before %%DBFLAG%%there are two slashes //. In between these slashes enter your trace SQL bit mask. I normally use 135. So the parameter list should now look like this:

%%DBTYPE%%/%%DBNAME%%/%%OPRID%%/%%OPRPSWD%%/%%RUNCNTLID%%/%%INSTANCE%%/135/%%DBFLAG%%

cobol-sql-process-definition-trace-override.png

Finally, run your COBOL through the appropriate run control page. In the view log/trace file list you should see a file with the extension .trc. This is the COBOL SQL trace with timings.

cobol-trace-file-in-process-monitor-file-list.png

Compliling

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.

The steps for compiling COBOL locally are:

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:

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

Alternatively you could add %PS_HOME%\src\cbl\win32 to your 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.

If 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.