You are viewing the version of this documentation from Perl 5.43.11. This is a development version of Perl.

CONTENTS

NAME

perlos390 - building and installing Perl for z/OS (previously called OS/390)

SYNOPSIS

This document will help you Configure, build, test and install Perl on z/OS Unix System Services.

DESCRIPTION

Perl on z/OS has been tested on z/OS 3.1. It may work on other versions or releases.

The native character set for z/OS is EBCDIC (code page 1047 in North America), but recent OS releases have added the ability for individual processes to run in ASCII mode. This mode works reasonably well, but there can be glitches. It is under active development by IBM.

For background on the ASCII vs EBCDIC modes, see https://makingdeveloperslivesbetter.wordpress.com/2022/01/07/is-z-os-ascii-or-ebcdic-yes/

Perl can support either mode, but you have to compile it explicitly for one or the other. You could have both an ASCII perl, and an EBCDIC perl on the same machine. If you use an ASCII perl, the Encode module shipped with perl can be used to translate files from various EBCDIC code pages for handling by perl, and then back on output. The iconv command in z/OS, may also be useful.

z/OS has a native shell much like ksh or bash, and many commands that are similar to ones in Linux, such as sed. Available options for these may differ from the Linux ones. But not many Open Source tools that a Linux user might be accustomed to using come with base z/OS.

However, there is now an Open Source for z/OS initiative to bring many such tools to z/OS users. https://zopen-community brings you to its landing page. If an ASCII perl is sufficient for your needs, you should obtain it through them, at https://zopen-community/perlport.

There aren't any known 32-bit z/OS systems in existence anymore, so this document describes how to build a 64-bit EBCDIC Perl.

Most CPAN modules have been written assuming ASCII. They may or may not work on EBCDIC. What we have found is that many do work, but may not appear to pass all their tests. They can be used in the areas that they do work in. Also the failure may not actually be a real failure, but a problem with the test. This is because the typical test compares results with expected values which the test's author often hard-coded assuming ASCII. For example, if you do a plain sort, ASCII will have the digits first, uppercase letters next, and lowercase last. EBCDIC sorts the opposite. If your application really does need the ASCII ordering, the module won't give the proper results; but often you just need a consistent sorting, and for that purpose the module works perfectly well.

Perl itself is shipped with some CPAN modules included. Some of these do not work well on EBCDIC, and therefore testing of them is suppressed. You can see which by examining t/TEST and searching for EBCDIC. Fixing these is under active development.

Tools

The tools required for building perl are available as:

Building EBCDIC Perl on z/OS

Getting perl source

You'll first need a tarball. At the moment this is written, there are no EBCDIC tarballs published, but it is easy to create one given that you have access to a system with any relatively modern perl.

Then get an ASCII release tarball. Choose one of the following:

Official stable release

Go to https://www.perl.org/get.html and choose any one of the "Download latest Linuxy stable source" buttons. The name of that tarball will be something like perl-V.R.M,tar,gz, where V.R.M is the version/release/modification of the perl you are downloading. Do

gunzip perl-V.R.M.tar.gz
pax -r -f perl-V.R.M.tar

This will create a directory named perl-V.R.M, which you can rename to be whatever you want. The instructions below assume you choose perl.

Development release

If instead you want the latest unstable development release, clone Perl:

git clone https://github.com/Perl/perl5.git perl

Either way, after getting the perl directory populated, do

cd perl
perl Porting/makerel -c -e

This will use whatever perl already is on the system to create an EBCDIC tarball named perl-V.R.M.tar.gz.

Use scp or sftp to copy the tarball to the target z/OS system. Then, from the directory where it is located, do

gunzip perl-V.R.M.tar.gz
pax -r -f perl-V.R.M.tar
mv perl-V.R.M perl
cd perl

Configuring perl

Now it is time to Configure it to your needs. If you need a dynamically loading perl (see below), first do:

export PATH=$PWD:$PATH
export LIBPATH=$PWD:$LIBPATH

Then run Configure

./Configure -Dprefix=/path-to/install/directory -des \
                              OTHER-OPTIONS-AS-BELOW

-d means to use the default configuration values. This is important, as we have set those up specifically for z/OS.

-e means to continue on to the bitter end, not stopping the process early.

-s means to avoid unnecessary output verbiage. This parameter is optional.

If the perl is an unstable development release, add -Dusedevel as one of the OTHER-OPTIONS-AS-BELOW

If you think you may want to debug the perl, add -DDEBUGGING -Aoptimize=-g3 -Aoptimize=-ggdb3.

To silence some unnecessary compilation warnings, you can add -Accflags=-Wno-deprecated.

If you will want to use modules from CPAN (like DBI (and DBDs), JSON::XS, and Text::CSV_XS), consider using dynamic loading. This isn't necessary if all such modules you might want are written only in Perl, but if some of them are compiled (they contain XS code), you'll either need to recompile all of perl when you add one, or set it up initially to use dynamic loading. To do this, add -Dusedl to the Configure options.

When Configure is run using the z/OS native shell, you'll see a message like

(I see you are using the Korn shell.  Some ksh's blow up on Configure,
mainly on older exotic systems.  If yours does, try the Bourne shell
instead.)

The native shell looks like ksh, and it works fine, so just ignore the message.

Configure currently will output errors in finding the header dependencies various object files have. This just means that they may be recompiled unnecessarily.

Building perl

Run GNU make to build Perl

make

This will likely crash in making the Encode module. To work around that, execute the following command

chtag -tc IBM-1047 cpan/Encode/Makefile

and rerun make.

Testing perl

TEST_JOBS=n make test_harness

where n is the number of tests to run in parallel. On hardware that is single core, 2 or 3 work well. A common value (if you aren't crowding out other users) is to set n to twice the number of cores available, plus 1.

Some tests currently fail. The only ones that are real known errors are in io/socket.t.

The failing tests in Test-Simple, Pod-Html, op/signatures, and io/nargv.t are false alarms.

Installing perl

make install

will install perl into the directory you gave in the command

./Configure -Dprefix=/path-to/install/directory ...

Optimization

Optimization has not been tested.

Installing other modules

Pure Perl (that is non XS) modules may be installed via the usual:

perl Makefile.PL
make
make test
make install

If you built perl with dynamic loading capability then that would also be the way to build XS based extensions. However, if you built perl with static linking you can still build XS based extensions for z/OS but you will need to follow the instructions in ExtUtils::MakeMaker for building statically linked perl binaries. In the simplest configurations building a static perl + XS extension boils down to:

perl Makefile.PL
make
make perl
make test
make install
make -f Makefile.aperl inst_perl MAP_TARGET=perl

Running EBCDIC Perl on z/OS

To run the 64-bit Dynamic Perl environment, update your PATH and LIBPATH to include the location you installed Perl into, and then run the perl you installed as perlV.R.M where V/R/M is the Version/Release/Modification level of the current development level.

AUTHORS

David Fiander and Peter Prymmer with thanks to Dennis Longnecker and William Raffloer for valuable reports, LPAR and PTF feedback. Thanks to Mike MacIsaac and Egon Terwedow for SG24-5944-00. Thanks to Ignasi Roca for pointing out the floating point problems. Thanks to John Goodyear for dynamic loading help.

Mike Fulton and Karl Williamson have provided updates for UTF8, DLL, 64-bit and ASCII/EBCDIC Bi-Modal support

HISTORY

Updated 25 May 2026 to reflect Perl v5.44 and

Updated 24 December 2021 to enable initial ASCII support

Updated 03 October 2019 for perl-5.33.3+

Updated 28 November 2001 for broken URLs.

Updated 12 March 2001 to mention //'SYS1.TCPPARMS(TCPDATA)'.

Updated 24 January 2001 to mention dynamic loading.

Updated 15 January 2001 for the 5.7.1 release of Perl.

Updated 12 November 2000 for the 5.7.1 release of Perl.

This document was podified for the 5.005_03 release of Perl 11 March 1999.

This document was originally written by David Fiander for the 5.005 release of Perl.