Home / Alt manpages / perlbs2000(1)

  • perlbs2000(1)
  • User command
  • linux

Build Historical Perl for BS2000 Without Guessing at the Port

You will finish with a sensible plan for building Perl in the BS2000 POSIX subsystem, including the ASCII to EBCDIC file boundary, the parser tools the port once needed, and a way to interpret its old test results. The local perlbs2000(1) page is documentation, not an installed command. On this machine it comes from perl-doc version 5.38.2-3.2ubuntu0.6, while the page itself describes a port first written for Perl 5.005.

Allow at least an hour for reading the platform documentation and preparing a controlled build, longer for an actual compile. You need BS2000 POSIX access, an ASCII filesystem, an EBCDIC filesystem, a Perl source archive, gzip, GNU bison, GNU make, and enough space for two copies of the source tree. The examples are based on the installed page and current upstream's matching README.bs2000; verify each tool and path on your host before running it.

Checkpoint

Do not start by copying these commands into a Linux shell. They target BS2000 POSIX and contain platform-specific conversion settings.

1. Establish which instructions you are following

Read the local page and record its version before making a build plan:

$ man perlbs2000
$ dpkg-query -W perl-doc
perl-doc 5.38.2-3.2ubuntu0.6

The page says that it needs updating and identifies its history as Perl 5.005 documentation, podified for Perl 5.6 in 2000. Current upstream still carries README.bs2000 with the same warning and broadly the same platform notes. That is useful evidence of the port's intended workflow, not a promise that the old tool versions or every reported defect apply to a modern Perl release.

Do not infer that the presence of this manpage proves that BS2000 support is tested in the Debian or Ubuntu package. This Linux host has the documentation package, but no perlbs2000 executable.

2. Prepare separate ASCII and EBCDIC working areas

The archive is ASCII data, while the target tree is copied to an EBCDIC filesystem. The documented workflow deliberately uses different conversion settings at each boundary. Replace the example paths with directories that exist on your BS2000 host:

cd /usr/local/ascii
export IO_CONVERSION=NO
gunzip < /usr/local/src/perl.tar.gz | pax -r

cd /usr/local/src
IO_CONVERSION=YES cp -r /usr/local/ascii/perl5.005_02 ./

The first extraction avoids I/O conversion in the ASCII area. The second command copies the complete tree with conversion enabled. The old notes say that pax may print an error about the first archive element not looking like a tar archive; the directory entry is created automatically and that particular message can be ignored.

Safety warning

Check the destination before the recursive copy. It changes a whole source tree and can overwrite files with the same names. If the copy is wrong, stop, remove or rename only the mistaken destination using your site's recovery procedure, then repeat from a clean source tree. Do not delete the ASCII copy until the EBCDIC copy has been inspected.

3. Check the build tools and parser arrangement

The page reports that the native yacc did not work for this port. It used GNU bison 1.25, with EBCDIC-related changes, and GNU make. It also used a separate native yacc link for a2p.y. Treat those versions as historical constraints to investigate, not as a recommendation to install obsolete software without checking your platform's support policy.

The documented wrapper adds the reentrant parser declaration, calls Bison in yacc mode, and removes its temporary input. If your build instructions still require this arrangement, create it only in a private tools directory and review it before placing it on PATH:

ln -s /usr/bin/yacc /usr/local/bin/byacc

tmpfile=/tmp/bison.$$.y
echo %pure_parser > "$tmpfile"
cat "$1" >> "$tmpfile"
/usr/local/bin/bison --yacc "$tmpfile"
rm -f "$tmpfile"

This shortened example shows the critical operations, but it is not a drop-in replacement for a complete build wrapper: the old script preserved arguments and passed the source filename. Keep the complete upstream or site-reviewed wrapper if your release requires it. The temporary file uses the process ID, so also follow your host's rules for temporary-file safety.

4. Configure and compile, then test before installing

Use the source distribution's own Configure and make instructions for the Perl release you selected. The BS2000 notes say that hints.posix-bc supplies most platform values, because posix-bc is the name returned by uname. They also identify EBCDIC as the central portability issue.

$ ./Configure
$ make
$ make test

Do not copy the old test score into a release report. The historical run recorded 11 failed test scripts and 57 failed subtests, with failures in numeric conversion, regular expressions, warnings, floating point and other areas. Some were attributed to Bison's different parser diagnostic. Your results may differ, and a modern release may have different tests entirely.

Checkpoint

Save the complete test log and investigate every failure before installation. A known historical failure is not automatically harmless on your build. Compare the exact Perl release, compiler, parser, filesystem conversion and test names before deciding whether to proceed.

Installation may require the privilege granted by your BS2000 site policy, especially if the destination is shared. Elevate only for the installation action, not for source inspection or testing. The page notes that documentation installation produced errors because that environment lacked nroff; do not hide unrelated compile or test errors under that explanation.

5. Run scripts with the correct launcher

BS2000 POSIX did not support the usual Unix shebang notation in the documented environment. A script intended for that shell therefore used a shell-compatible preamble:

: # use perl
eval 'exec /usr/local/bin/perl -S $0 ${1+"$@"}'
    if 0;

Use the actual installed Perl path, and test the launcher with a harmless script before converting a larger application. Do not assume that a script copied from Linux will select the right interpreter merely because it begins with #!/usr/local/bin/perl.

6. Choose an explicit encoding policy

Since Perl 5.8, the BS2000 notes describe PerlIO as the preferred way to select an encoding for each channel. This avoids making the filesystem's character set silently decide every file's contents:

use Encode;
open($f, ">:encoding(ascii)", "test.ascii");
print $f "Hello World!\n";
open($f, ">:encoding(posix-bc)", "test.ebcdic");
print $f "Hello World!\n";
open($f, ">:encoding(latin1)", "test.latin1");
print $f "Hello World!\n";

PerlIO uses raw I/O internally for these layers, so this choice ignores IO_CONVERSION. If you specifically need the older filesystem-driven behaviour, the page gives this alternative:

export IO_CONVERSION=YES
export PERLIO=stdio

Pick one policy deliberately and verify the bytes produced on both filesystem types. Mixing the two models in one program is a reliable way to create files that look correct in one environment and fail in another.

7. Treat floating point results as platform-specific

The page records a BS2000 POSIX floating point anomaly where mathematically equivalent multiplication and division paths produce different results after int:

my $x = 100000.0;
my $y = int($x * 1e-5) * 1e5;
my $z = int($x / 1e+5) * 1e5;
print "$y is $y and $z is $z\n";

Do not use that example as a generic Perl rule. Reproduce it only while characterising the target runtime, then avoid relying on fragile floating point identities in production code. Use test cases that exercise the calculations your application actually needs.

Done means

  • You confirmed that perlbs2000(1) is historical documentation, not a local build utility.
  • You have separate, verified ASCII and EBCDIC working areas and understand where conversion is enabled.
  • Your Perl release, Bison, make, compiler and platform assumptions are recorded.
  • You saved and reviewed the complete make test results before installing.
  • Your scripts use the BS2000 launcher and an explicit, tested encoding policy.
  • You treated old test failures and floating point behaviour as evidence to investigate, not defaults to copy blindly.