p≡p on the Mainframe

The work so far

  • bzip2 1.0.6 for z/OS
  • GNU make 4.1.90 for z/OS
  • gzip 1.3.12 for z/OS
  • unzip 6.00 for z/OS
  • zip 3.0 for z/OS

Download archive

This archive is meant to be the content of /usr/local. It’s including source code and installed binaries. To use it with the z/OS UNIX shell or with tcsh you need to add /usr/local/bin to the PATH.

On the development machine zfsadm define was being used to add the dataset VENDOR.UNIX.ZFS to a DASD and create a zFS filesystem in it. This can be mounted using the TSO/E shell by:


IBM z/OS as platform

z/OS is an operating system coming with two subsystems: MVS and UNIX. The idea of the port is to make p≡p available in all subsystems and all middleware like CICS, IMS, DB/2 etc.

p≡p is being developed on a VM with actual z/OS being rent from IBM Z Dallas ISV Center.

EBCDIC instead of ASCII based character sets

z/OS is not based on the ASCII character set. Instead, this operating system is using EBCDIC, an alternative. This has impact, because p≡p engine’s source code needs to be transcoded to EBCDIC to be compiled.

OpenSSH on z/OS

The z/OS UNIX there has an implementation of OpenSSH, which is transcoding transmitted data from ASCII to EBCDIC when using scp while it’s not when using sftp.

So sftp is to be used when copying i.e. a tar file to the Mainframe, because its binary format must be preserved while copying. scp can be used to directly copy text files, though.

tar and pax

z/OS’s pax command can transcode while reading from or writing to an archive. From pax’ man page:

For example, to convert from ASCII to EBCDIC, use:


From EBCDIC to ASCII, use:


Because pax can be used for tar files, instead of the usual

tar xf some.tar

for source code, which needs to be transcoded a command line can be:

pax -r -ofrom=ISO8859-1,to=IBM-1047 -f some.tar

Porting p≡p engine’s build dependencies


bzip2 is not directly a build dependency of p≡p. But it’s very uncomfortable to work without when using GNU software. So this was being built first.

The tar archive can be read using pax applying transcoding to EBCDIC. There is an exception for the sample* files, though, because they’re binary. They must be extracted without transcoding or the test bench will not work.

Manually setting compiler frontends and flags in Makefile is enough to execute a successful build. For compiling cc -O2 is being used. For linking c89.

GNU make

z/OS Unix is delivering a fairly recent version of Stuart Feldman’s make. p≡p engine’s build system is based on GNU make, though.

A couple of small patches where needed to get it to work on z/OS. The __MVS__ macro is being used for the needed #ifdef’s.

The c89 compiler was used to compile GNU make. Because of this, some patches were needed where GNU make’s developers are using newer features. Mainly it was normalizing to C style comments and removing variable initialization from for(). c89 is only supporting the int type for bitfields.

z/OS does not support the envp parameter for main(). But it is POSIX compliant, so extern char **environ can be used instead.

To translate GNU make it must be configured with:

./configure CC=c89 am_cv_prog_cc_c_o=yes

The latter is required because configure wrongly detects the compile wrapper being needed.


Newer versions of gzip seem to depend on having F_DUPFD_CLOEXEC in the kernel. This is not available in z/OS. Therefore, gzip-1.3.12 was being used.

gzip was being configured with:



z/OS is a supported platform for unzip, so it’s all about:

make -f unix/Makefile os390


z/OS is a supported platform for zip, so it’s all about:

make -f unix/Makefile os390


A c99 compiler is available from the IBM, so this build dependency is fulfilled.

Porting p≡p engine’s dependencies


p≡p MIME is requiring C++ 14. IBM’s C++ compiler is delivering C++ 11. So libetpan’s MIME implementation is a dependency for p≡p engine.


p≡p engine is deploying an amalgam of SQLite3.

Implementing a crypto backend for the Mainframe

Building p≡p engine as DLL

Implementing the p≡p Mainframe adapter based on IBM Language Environment