Using Open COBOL with PeopleSoft

COBOL in PeopleSoft has long been one of my frustrations.  I have had trouble with change assistant not getting the right version of the files in the correct directories.  The compiler is an extra set of steps for installing and getting the system working.  The license has to be installed in addition to the compiler, and most likely several run time environments.  Typically, you would have to ship the COBOL programs between servers assuming you only have one server that is licensed to compile.

I can understand paying money for a program that you use, but COBOL doesn’t fit that description in my mind.  Every client that I have worked at won’t touch a COBOL program: every customization must be outside the COBOL programs.  So, why then should I have to pay thousands of dollars for a COBOL compiler?

So, I thought I would play with an open source compiler.  I thought it would do two things:

  1. Maybe in some small way influence toward Open COBOL as an official certified alternative
  2. Help me better learn how the COBOL system works

So, here’s what I learned:

Installing Open COBOL on Oracle Linux

The hardest part about installing Open COBOL was getting the dependencies.  Thankfully, I finally found someone who mentioned this command that would install all the needed dependencies:

yum install gmp-devel libtool db4 db4-devel

Then, I downloaded the 1.0 version from Source Forge:
Open COBOL Download Page

These are the commands that I used to compile and install the package:

tar -xzvf open-cobol-1.0.tar.gz
cd open-cobol-1.0
./configure
make
sudo make install

So, this is the version that I ended up with


$ cobc -V
cobc (OpenCOBOL) 1.0.0
Copyright (C) 2001-2007 Keisuke Nishida
Copyright (C) 2007 Roger While

Compiling

My first challenge regarding compiling was trying to figure out if I should try to modify the delivered pscbl.mak, pscbl_mf.mak, and psrun.mak scripts or create my own from scratch.  I decided to go with my own script.

For options, this is what I used:

  • –std=mf: use the Microfocus dialect
  • -o: output to a different file/directory; allowed me to mimic the way PeopleSoft places the compiled files in a separate directory
  • -t: create a listing for debugging purposes

Note that I let it create the default dynamically loadable module rather than specifying the -x option to compile to an executable.  I did this with the intention to take advantage of the cobcrun program.  Also, I didn’t have t0 figure out which files were main programs and which were just libraries.

I created this script in the PeopleSoft home setup directory to do the compile:


#!/bin/sh

if [ ! -e "$PS_HOME" ]; then
	BASEDIR=$(dirname "$0")
	PSCONFIG="$BASEDIR/../psconfig.sh"
	if [ -e "$PSCONFIG" ]; then
		. $PSCONFIG
	fi
fi
if [ -e "$PS_HOME" ]; then
	echo "PS_HOME = $PS_HOME"
else
	echo "Error -- PS_HOME not set or does not exist"
fi
LOGDIR=$PS_HOME/cblout
OUTDIR=$PS_HOME/cblopen
if [ ! -e "$LOGDIR" ]; then
	mkdir "$LOGDIR"
fi
if [ ! -e "$OUTDIR" ]; then
	mkdir "$OUTDIR"
fi
cd $PS_HOME/src/cbl
rm $LOGDIR/success.txt
rm $LOGDIR/fail.txt
for cbl in $(ls *.cbl); do
	echo "Compiling $cbl..."
	BASENAME=$(echo "$cbl" | sed 's/\..*$//')
	cobc -std=mf $cbl  -o "$OUTDIR/$BASENAME.so" -t "$LOGDIR/$BASENAME.lis" > $LOGDIR/$BASENAME.out 2>&1
	if [ "$?" == 0 ]; then
		echo "$cbl" >> $LOGDIR/success.txt
		echo "    success"
	else
		echo "$cbl" >> $LOGDIR/fail.txt
		echo "    fail"
	fi
done

Trying to Run a program

PTPDBTST is the natural choice for the first test.  It’s just a quick program to make sure that COBOL programs can talk to the database.


[PS@HCM92 cblopen]$ cobcrun PTPDBTST
libcob: Cannot find module 'CBL_GET_OS_INFO'

Unfortunately, the program didn’t work, and it seemed that every program I tried failed with the same error.  If I understood it correctly, this CBL_GET_OS_INFO module is a MicroFocus specific module.

Microfocus Compiler Flags

As I was going through trying to figure out how to compile, I did a little poking into the compile options that PeopleSoft’s script uses.  First, the PSCBL_MF.MAK script has two different compiles:

Compile 1:

cob $PSCOBOPT $PS_IGNORE -C ‘MAKESYN “COMP-5” == “COMP”‘ -C ‘OVERRIDE “TIME-OUT” == “TIME-OUT-MF”‘ -C ‘ANS85 “SYNTAX”‘  -W e -P $cblfile.cbl

  • PSCOBOPT = -C CHECKDIV”OSVS” -C ERRLIST -C WARNING=1 -C IBMCOMP -C NOALTER -C NOFORM -C NOQUERY -C NOOSVS -C BOUND -C VSC2  -C INTLEVEL”4″
  • PS_IGNORE = -C REMOVE”INSTANCE” -C REMOVE”INTERFACE-ID” -C REMOVE”PARSE”
  • -C: pass compiler directive to the compiler
  • CHECKDIV: allow dividing by zero
  • ERRLIST: Print messages only
  • WARNING: Level of message to output
  • IBMCOMP: Word storage mode
  • NOALTER: ???
  • NOQUERY: Don’t pause if a copy file is missing; just print as an error
  • NOOSVS: OS/VS reserved words are not to be treated as reserved words
  • BOUND: Bound-check
  • VSC2: Truncate according to the rules of VS COBOL II and COBOL/370.
  • INTLEVEL: Portability Level
  • REMOVE”INSTANCE” De-reserve Instance keyword
  • REMOVE”INTERFACE-ID”: De-reserve Interface-ID keyword
  • REMOVE”PARSE”: De-reservce Parse keyword
  • MAKESYN: Make COMP-5 the same as COMP
  • OVERRIDE: Change the meaning of TIME-OUT to TIME-OUT-MF
  • ANS85: Use the ANS85 Keywords
  • -W e: set the warning level to “error”
  • -P: create a listing file

Compile 2:

cob $PSCOBOPT $PS_IGNORE -C ‘MAKESYN “COMP-5” == “COMP”‘ -C ‘OVERRIDE “TIME-OUT” == “TIME-OUT-MF”‘ -C ‘ANS85 “SYNTAX”‘ -u -W e -P $cblfile.cbl

The one different that I notice in this second option is:

  • -u: compile to generated code for an unlinked environment

Creating PSRUN —

$PS_COB $PS_COBFLAGS -W e -e “” -x -o $PS_PSRUN $PS_OSLIBS_DIR $PS_OSLIBS -L$PS_HOME/bin $PS_CLIBS_DEFAULT 2> $PS_ERRFILE

  • PS_COB = cob: the Microfocus compiler
  • PS_COBFLAGS = blank: option arguments, set for AIX and HP Unix environments
  • -W e: set the warning level to “error”
  • -e “”: means that the “entry point” should be passed on the command-line to the program
  • -x: tells it to compile to a system executable
  • PS_PSRUN = “PSRUN”: the actual executable file to create

PeopleTools COBOL Programs

  • PTPUSTAT: Updates the status for the process scheduler
  • PSPCLBLD.cbl calls PTPUSTAT in the DB000-SET-RUN-STAT-PROCESSING section.
  • SQLRT storage comes from: PTCSQLRT.cbl
  • USTAT (PROCESS SCHEDULER REQUEST STATUS INTERFACE) comes from: PTCUSTAT.

COBOL Programs that I usually use

  • PSPPYBLD: Create Paysheets
  • PSPPYRUN: Payroll Calculation
  • PSPCNFRM: Payroll Confirmation
  • PTPDBTST: Simple COBOL Test Program
  • PTPDTTST: COBOL Database Test Program

Resources

9 thoughts on “Using Open COBOL with PeopleSoft

  1. That’s quite interesting, very nice investigation.
    I’ve never been so in depth on cbl, less I go onto there, better I am.
    That said, if you have payroll cobol run for hundreds of employees, do you not want your configuration in alignement within PSoft matrix certification ?
    What’s Microfocus version and PTools are you on ?
    Within the latest Peopletools version (8.51+), you may want to use some other compiler than Microfocus available on some plateform (AIX, Windows) such as IBM Compiler (see Doc ID 1212164.1).
    As explained, the complation scripts are different but source are same. So there must be a way to tell the compiler to work properly, isn’t it ?
    Great challenge !

    Nicolas.

    1. Were you able to finally get this to work? I am not having any luck getting Cobol to run in a PS HCM env after the 30 day license.
      Does anyone have any other alternatives?

      1. How did you get a 30 day-trail license? Are able to use a license from PeopleSoft HCM 9.2 environment and put in your Environment? Is that possible ?

        Thanks
        Les

    2. Nicolas,

      I’m sorry it has taken me so long to respond. I’ve had it on my list to write back, but I kept getting distracted.

      The experimenting that I have done on this was just for educational purposes. I don’t want to pay $10,000 for an instance of PeopleSoft that I am using in my spare time to train myself on how payroll works, etc. I would never put this into a production environment.

      The PeopleTools was version 8.53, and the Microfocus COBOL was the version on eDelivery.

      I heard about the IBM compiler, but I don’t remember seeing either a place to download or a price.

      From the error, I got the impression that it was some type of API that was proprietary to Microfocus and not implemented in Open COBOL. I assumed there was no way to make it work without implementing those missing functions. I did find a place where I could tell Open COBOL to work like Microfocus, but it didn’t seem to help.

      1. For learning purpose, for sure that’d be nice. An other way, on an other level, would be a virtual machine. On the same level that the old Peoplesoft VM was delivered on Oracle VM. We had one VM for the database, and one for the App/Batch/PIA server. Whether you could keep the first, the latter could be reloaded as often as you wanted, especially useful to build one dedicated to the COBOL. That was what I did : one App/Batch VM for all other stuff (e.g. sqr), one for COBOL dedicated. There was an option to install everything and compile COBOL on VM deployment. I’m sure we can do the same by ourself as well, I did not try it yet though.
        Whether that’s an other story, that’s also a good excercise I’d try.

        Nicolas.

  2. Hi. I’ve been trying to use open cobol as my cobol compiler for PeopleSoft ELM 9.2+ but the catch is.. it is on Windows. Did you ever tried to configure open cobol as compiler on Windows? I have installed open cobol on Windows using Cygwin.

    Your response is truly appreciated. THanks!

    Rachel

    1. Rachel,

      I haven’t tried it on Windows. I assume that it would work very similar. I never got it to work on Linux, so I am thinking I wouldn’t have it working on Windows either.

      You may have to make the PSRUN a batch file that calls the COBOL running inside Cygwin. That might be the bridge between the two.

      I have been thinking about using the VirtualBox images from the PUM home on Oracle Support for my learning and experimenting. I would install the Microfocus trial. I was thinking that a new image would come out about the time the trial expired. I haven’t quite gone down that route yet though.

      Keep in mind that this would only be of any value in a non-production environment. As Nicolas pointed out, you don’t want to run a real payroll on an unsupported configuration. This is only for learning and experimenting that you don’t want to do on a client’s system.

      1. Hi digitaleagle,

        I’ve been trying to use open cobol as my cobol compiler but I’ve haven’t found any luck. Now i’m quite enlightened. Thanks for this info 🙂

        Rachel

  3. Hi All,
    I too was interested in a free COBOL compiler for my local PS instance when I happened on this thread.

    Thanks for posting the procedure to compile.

    You are correct that the CBL_GET_OS_INFO is a Microfocus function.
    See the link below:

    https://psst0101.digitaleagle.net/2013/09/12/using-open-cobol-with-peoplesoft/

    However I am thinking there should be a common PeopleTools COBOL module either
    a copybook PTC*.cbl or a program PTP*.cbl that is calling this function.

    The syntax should be as follows:

    call “CBL_GET_OS_INFO” using [PEOPLESOFT Working Storage Variables]
    returning status-code

    All you will need to do is comment out all the lines associated with this call statement
    by placing an * in the seventh (7th) column position.

    You will want to default the variables based on the documentation from the above link.
    The defaults should not change for your environment as long as you do not upgrade the OS.

    When I get a chance to play around with this,
    I will try this hack to see if I can get my COBOLs working.

    Whether I get it to work or not I will post to let you know.

    If it works, I will give you more details about what I changed.

    Best Regards,
    Mark Burton

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.