xref: /openbsd-src/gnu/usr.bin/perl/README.bs2000 (revision e068048151d29f2562a32185e21a8ba885482260)
1*e0680481Safresh1# vim: syntax=pod
2*e0680481Safresh1
3c48bdce4SmillertThis document is written in pod format hence there are punctuation
455745691Smillertcharacters in odd places.  Do not worry, you've apparently got the
5c48bdce4SmillertASCII->EBCDIC translation worked out correctly.  You can read more
6c48bdce4Smillertabout pod in pod/perlpod.pod or the short summary in the INSTALL file.
7c48bdce4Smillert
8c48bdce4Smillert=head1 NAME
9c48bdce4Smillert
10898184e3Ssthenperlbs2000 - building and installing Perl for BS2000.
11c48bdce4Smillert
12b8851fccSafresh1B<This document needs to be updated, but we don't know what it should say.
1398dafc01Safresh1Please submit comments to L<https://github.com/Perl/perl5/issues>.>
14b8851fccSafresh1
15c48bdce4Smillert=head1 SYNOPSIS
16c48bdce4Smillert
17c48bdce4SmillertThis document will help you Configure, build, test and install Perl
18c48bdce4Smillerton BS2000 in the POSIX subsystem.
19c48bdce4Smillert
20c48bdce4Smillert=head1 DESCRIPTION
21c48bdce4Smillert
22c48bdce4SmillertThis is a ported perl for the POSIX subsystem in BS2000 VERSION OSD
23c48bdce4SmillertV3.1A or later.  It may work on other versions, but we started porting
24c48bdce4Smillertand testing it with 3.1A and are currently using Version V4.0A.
25c48bdce4Smillert
26c48bdce4SmillertYou may need the following GNU programs in order to install perl:
27c48bdce4Smillert
2855745691Smillert=head2 gzip on BS2000
29c48bdce4Smillert
30c48bdce4SmillertWe used version 1.2.4, which could be installed out of the box with
31c48bdce4Smillertone failure during 'make check'.
32c48bdce4Smillert
3355745691Smillert=head2 bison on BS2000
34c48bdce4Smillert
35c48bdce4SmillertThe yacc coming with BS2000 POSIX didn't work for us.  So we had to
36c48bdce4Smillertuse bison.  We had to make a few changes to perl in order to use the
37c48bdce4Smillertpure (reentrant) parser of bison.  We used version 1.25, but we had to
38c48bdce4Smillertadd a few changes due to EBCDIC.  See below for more details
39c48bdce4Smillertconcerning yacc.
40c48bdce4Smillert
4155745691Smillert=head2 Unpacking Perl Distribution on BS2000
42c48bdce4Smillert
43c48bdce4SmillertTo extract an ASCII tar archive on BS2000 POSIX you need an ASCII
44c48bdce4Smillertfilesystem (we used the mountpoint /usr/local/ascii for this).  Now
45c48bdce4Smillertyou extract the archive in the ASCII filesystem without
46c48bdce4SmillertI/O-conversion:
47c48bdce4Smillert
48c48bdce4Smillertcd /usr/local/ascii
49c48bdce4Smillertexport IO_CONVERSION=NO
50c48bdce4Smillertgunzip < /usr/local/src/perl.tar.gz | pax -r
51c48bdce4Smillert
52c48bdce4SmillertYou may ignore the error message for the first element of the archive
53c48bdce4Smillert(this doesn't look like a tar archive / skipping to next file...),
54c48bdce4Smillertit's only the directory which will be created automatically anyway.
55c48bdce4Smillert
56c48bdce4SmillertAfter extracting the archive you copy the whole directory tree to your
57c48bdce4SmillertEBCDIC filesystem.  B<This time you use I/O-conversion>:
58c48bdce4Smillert
59c48bdce4Smillertcd /usr/local/src
60c48bdce4SmillertIO_CONVERSION=YES
61c48bdce4Smillertcp -r /usr/local/ascii/perl5.005_02 ./
62c48bdce4Smillert
6355745691Smillert=head2 Compiling Perl on BS2000
64c48bdce4Smillert
65c48bdce4SmillertThere is a "hints" file for BS2000 called hints.posix-bc (because
66c48bdce4Smillertposix-bc is the OS name given by `uname`) that specifies the correct
67c48bdce4Smillertvalues for most things.  The major problem is (of course) the EBCDIC
68c48bdce4Smillertcharacter set.  We have german EBCDIC version.
69c48bdce4Smillert
70c48bdce4SmillertBecause of our problems with the native yacc we used GNU bison to
71c48bdce4Smillertgenerate a pure (=reentrant) parser for perly.y.  So our yacc is
72c48bdce4Smillertreally the following script:
73c48bdce4Smillert
74c48bdce4Smillert-----8<-----/usr/local/bin/yacc-----8<-----
75c48bdce4Smillert#! /usr/bin/sh
76c48bdce4Smillert
77c48bdce4Smillert# Bison as a reentrant yacc:
78c48bdce4Smillert
79c48bdce4Smillert# save parameters:
80c48bdce4Smillertparams=""
81c48bdce4Smillertwhile [[ $# -gt 1 ]]; do
82c48bdce4Smillert    params="$params $1"
83c48bdce4Smillert    shift
84c48bdce4Smillertdone
85c48bdce4Smillert
86c48bdce4Smillert# add flag %pure_parser:
87c48bdce4Smillert
88c48bdce4Smillerttmpfile=/tmp/bison.$$.y
89c48bdce4Smillertecho %pure_parser > $tmpfile
90c48bdce4Smillertcat $1 >> $tmpfile
91c48bdce4Smillert
92c48bdce4Smillert# call bison:
93c48bdce4Smillert
94c48bdce4Smillertecho "/usr/local/bin/bison --yacc $params $1\t\t\t(Pure Parser)"
95c48bdce4Smillert/usr/local/bin/bison --yacc $params $tmpfile
96c48bdce4Smillert
97c48bdce4Smillert# cleanup:
98c48bdce4Smillert
99c48bdce4Smillertrm -f $tmpfile
100c48bdce4Smillert-----8<----------8<-----
101c48bdce4Smillert
102c48bdce4SmillertWe still use the normal yacc for a2p.y though!!!  We made a softlink
103c48bdce4Smillertcalled byacc to distinguish between the two versions:
104c48bdce4Smillert
105c48bdce4Smillertln -s /usr/bin/yacc /usr/local/bin/byacc
106c48bdce4Smillert
107c48bdce4SmillertWe build perl using GNU make.  We tried the native make once and it
108c48bdce4Smillertworked too.
109c48bdce4Smillert
11055745691Smillert=head2 Testing Perl on BS2000
111c48bdce4Smillert
112c48bdce4SmillertWe still got a few errors during C<make test>.  Some of them are the
113c48bdce4Smillertresult of using bison.  Bison prints I<parser error> instead of I<syntax
114c48bdce4Smillerterror>, so we may ignore them.  The following list shows
115c48bdce4Smillertour errors, your results may differ:
116c48bdce4Smillert
117c48bdce4Smillertop/numconvert.......FAILED tests 1409-1440
118c48bdce4Smillertop/regexp...........FAILED tests 483, 496
119c48bdce4Smillertop/regexp_noamp.....FAILED tests 483, 496
120c48bdce4Smillertpragma/overload.....FAILED tests 152-153, 170-171
121c48bdce4Smillertpragma/warnings.....FAILED tests 14, 82, 129, 155, 192, 205, 207
122c48bdce4Smillertlib/bigfloat........FAILED tests 351-352, 355
123c48bdce4Smillertlib/bigfltpm........FAILED tests 354-355, 358
124c48bdce4Smillertlib/complex.........FAILED tests 267, 487
125c48bdce4Smillertlib/dumper..........FAILED tests 43, 45
126c48bdce4SmillertFailed 11/231 test scripts, 95.24% okay. 57/10595 subtests failed, 99.46% okay.
127c48bdce4Smillert
12855745691Smillert=head2 Installing Perl on BS2000
129c48bdce4Smillert
130c48bdce4SmillertWe have no nroff on BS2000 POSIX (yet), so we ignored any errors while
131c48bdce4Smillertinstalling the documentation.
132c48bdce4Smillert
133c48bdce4Smillert
13455745691Smillert=head2 Using Perl in the Posix-Shell of BS2000
135c48bdce4Smillert
136c48bdce4SmillertBS2000 POSIX doesn't support the shebang notation
137c48bdce4Smillert(C<#!/usr/local/bin/perl>), so you have to use the following lines
138c48bdce4Smillertinstead:
139c48bdce4Smillert
140c48bdce4Smillert: # use perl
141c48bdce4Smillert    eval 'exec /usr/local/bin/perl -S $0 ${1+"$@"}'
142eac174f2Safresh1        if 0; # ^ Run only under a shell
143c48bdce4Smillert
144c48bdce4Smillert=head2 Using Perl in "native" BS2000
145c48bdce4Smillert
146c48bdce4SmillertWe don't have much experience with this yet, but try the following:
147c48bdce4Smillert
148c48bdce4SmillertCopy your Perl executable to a BS2000 LLM using bs2cp:
149c48bdce4Smillert
150c48bdce4SmillertC<bs2cp /usr/local/bin/perl 'bs2:perl(perl,l)'>
151c48bdce4Smillert
152c48bdce4SmillertNow you can start it with the following (SDF) command:
153c48bdce4Smillert
154c48bdce4SmillertC</START-PROG FROM-FILE=*MODULE(PERL,PERL),PROG-MODE=*ANY,RUN-MODE=*ADV>
155c48bdce4Smillert
156c48bdce4SmillertFirst you get the BS2000 commandline prompt ('*').  Here you may enter
157c48bdce4Smillertyour parameters, e.g. C<-e 'print "Hello World!\\n";'> (note the
158c48bdce4Smillertdouble backslash!) or C<-w> and the name of your Perl script.
15955745691SmillertFilenames starting with C</> are searched in the Posix filesystem,
160c48bdce4Smillertothers are searched in the BS2000 filesystem.  You may even use
161c48bdce4Smillertwildcards if you put a C<%> in front of your filename (e.g. C<-w
162c48bdce4Smillertcheckfiles.pl %*.c>).  Read your C/C++ manual for additional
163c48bdce4Smillertpossibilities of the commandline prompt (look for
164c48bdce4SmillertPARAMETER-PROMPTING).
165c48bdce4Smillert
16655745691Smillert=head2 Floating point anomalies on BS2000
167c48bdce4Smillert
168c48bdce4SmillertThere appears to be a bug in the floating point implementation on BS2000 POSIX
169c48bdce4Smillertsystems such that calling int() on the product of a number and a small
170c48bdce4Smillertmagnitude number is not the same as calling int() on the quotient of
171c48bdce4Smillertthat number and a large magnitude number.  For example, in the following
172c48bdce4SmillertPerl code:
173c48bdce4Smillert
174c48bdce4Smillert    my $x = 100000.0;
175c48bdce4Smillert    my $y = int($x * 1e-5) * 1e5; # '0'
176c48bdce4Smillert    my $z = int($x / 1e+5) * 1e5;  # '100000'
177c48bdce4Smillert    print "\$y is $y and \$z is $z\n"; # $y is 0 and $z is 100000
178c48bdce4Smillert
179c48bdce4SmillertAlthough one would expect the quantities $y and $z to be the same and equal
180c48bdce4Smillertto 100000 they will differ and instead will be 0 and 100000 respectively.
181c48bdce4Smillert
18285009909Smillert=head2 Using PerlIO and different encodings on ASCII and EBCDIC partitions
18385009909Smillert
18485009909SmillertSince version 5.8 Perl uses the new PerlIO on BS2000.  This enables
18585009909Smillertyou using different encodings per IO channel.  For example you may use
18685009909Smillert
18785009909Smillert    use Encode;
18885009909Smillert    open($f, ">:encoding(ascii)", "test.ascii");
18985009909Smillert    print $f "Hello World!\n";
19085009909Smillert    open($f, ">:encoding(posix-bc)", "test.ebcdic");
19185009909Smillert    print $f "Hello World!\n";
19285009909Smillert    open($f, ">:encoding(latin1)", "test.latin1");
19385009909Smillert    print $f "Hello World!\n";
19485009909Smillert    open($f, ">:encoding(utf8)", "test.utf8");
19585009909Smillert    print $f "Hello World!\n";
19685009909Smillert
19785009909Smillertto get two files containing "Hello World!\n" in ASCII, EBCDIC, ISO
19885009909SmillertLatin-1 (in this example identical to ASCII) respective UTF-EBCDIC (in
19985009909Smillertthis example identical to normal EBCDIC).  See the documentation of
20085009909SmillertEncode::PerlIO for details.
20185009909Smillert
20285009909SmillertAs the PerlIO layer uses raw IO internally, all this totally ignores
20385009909Smillertthe type of your filesystem (ASCII or EBCDIC) and the IO_CONVERSION
20485009909Smillertenvironment variable.  If you want to get the old behavior, that the
20585009909SmillertBS2000 IO functions determine conversion depending on the filesystem
20685009909SmillertPerlIO still is your friend.  You use IO_CONVERSION as usual and tell
20785009909SmillertPerl, that it should use the native IO layer:
20885009909Smillert
20985009909Smillert    export IO_CONVERSION=YES
21085009909Smillert    export PERLIO=stdio
21185009909Smillert
21285009909SmillertNow your IO would be ASCII on ASCII partitions and EBCDIC on EBCDIC
21385009909Smillertpartitions.  See the documentation of PerlIO (without C<Encode::>!)
214898184e3Ssthenfor further possibilities.
21585009909Smillert
216c48bdce4Smillert=head1 AUTHORS
217c48bdce4Smillert
218c48bdce4SmillertThomas Dorner
219c48bdce4Smillert
220c48bdce4Smillert=head1 SEE ALSO
221c48bdce4Smillert
222c48bdce4SmillertL<INSTALL>, L<perlport>.
223c48bdce4Smillert
224c48bdce4Smillert=head2 Mailing list
225c48bdce4Smillert
22691f110e0Safresh1If you are interested in the z/OS (formerly known as OS/390)
22755745691Smillertand POSIX-BC (BS2000) ports of Perl then see the perl-mvs mailing list.
22855745691SmillertTo subscribe, send an empty message to perl-mvs-subscribe@perl.org.
229c48bdce4Smillert
23055745691SmillertSee also:
231c48bdce4Smillert
23256d68f1eSafresh1    https://lists.perl.org/list/perl-mvs.html
23355745691Smillert
23455745691SmillertThere are web archives of the mailing list at:
23555745691Smillert
23656d68f1eSafresh1    https://www.nntp.perl.org/group/perl.mvs/
237c48bdce4Smillert
238c48bdce4Smillert=head1 HISTORY
239c48bdce4Smillert
240c48bdce4SmillertThis document was originally written by Thomas Dorner for the 5.005
241c48bdce4Smillertrelease of Perl.
242c48bdce4Smillert
243c48bdce4SmillertThis document was podified for the 5.6 release of perl 11 July 2000.
244c48bdce4Smillert
245c48bdce4Smillert=cut
246