1PERLOS390(1) Perl Programmers Reference Guide PERLOS390(1)
2
3
4
6 README.os390 - building and installing Perl for OS/390 and z/OS
7
9 This document will help you Configure, build, test and install Perl on
10 OS/390 (aka z/OS) Unix System Services.
11
13 This is a fully ported Perl for OS/390 Version 2 Release 3, 5, 6, 7, 8,
14 and 9. It may work on other versions or releases, but those are the
15 ones we've tested it on.
16
17 You may need to carry out some system configuration tasks before
18 running the Configure script for Perl.
19
20 Tools
21 The z/OS Unix Tools and Toys list may prove helpful and contains links
22 to ports of much of the software helpful for building Perl.
23 http://www-1.ibm.com/servers/eserver/zseries/zos/unix/bpxa1toy.html
24
25 Unpacking Perl distribution on OS/390
26 If using ftp remember to transfer the distribution in binary format.
27
28 Gunzip/gzip for OS/390 is discussed at:
29
30 http://www-1.ibm.com/servers/eserver/zseries/zos/unix/faq/bpxqp1.html
31
32 to extract an ASCII tar archive on OS/390, try this:
33
34 pax -o to=IBM-1047,from=ISO8859-1 -r < latest.tar
35
36 or
37
38 zcat latest.tar.Z | pax -o to=IBM-1047,from=ISO8859-1 -r
39
40 If you get lots of errors of the form
41
42 tar: FSUM7171 ...: cannot set uid/gid: EDC5139I Operation not permitted.
43
44 you didn't read the above and tried to use tar instead of pax, you'll
45 first have to remove the (now corrupt) perl directory
46
47 rm -rf perl-...
48
49 and then use pax.
50
51 Setup and utilities for Perl on OS/390
52 Be sure that your yacc installation is in place including any necessary
53 parser template files. If you have not already done so then be sure to:
54
55 cp /samples/yyparse.c /etc
56
57 This may also be a good time to ensure that your /etc/protocol file and
58 either your /etc/resolv.conf or /etc/hosts files are in place. The IBM
59 document that described such USS system setup issues was SC28-1890-07
60 "OS/390 UNIX System Services Planning", in particular Chapter 6 on
61 customizing the OE shell.
62
63 GNU make for OS/390, which is recommended for the build of perl (as
64 well as building CPAN modules and extensions), is available from the
65 "Tools".
66
67 Some people have reported encountering "Out of memory!" errors while
68 trying to build Perl using GNU make binaries. If you encounter such
69 trouble then try to download the source code kit and build GNU make
70 from source to eliminate any such trouble. You might also find GNU
71 make (as well as Perl and Apache) in the red-piece/book "Open Source
72 Software for OS/390 UNIX", SG24-5944-00 from IBM.
73
74 If instead of the recommended GNU make you would like to use the system
75 supplied make program then be sure to install the default rules file
76 properly via the shell command:
77
78 cp /samples/startup.mk /etc
79
80 and be sure to also set the environment variable _C89_CCMODE=1
81 (exporting _C89_CCMODE=1 is also a good idea for users of GNU make).
82
83 You might also want to have GNU groff for OS/390 installed before
84 running the "make install" step for Perl.
85
86 There is a syntax error in the /usr/include/sys/socket.h header file
87 that IBM supplies with USS V2R7, V2R8, and possibly V2R9. The problem
88 with the header file is that near the definition of the SO_REUSEPORT
89 constant there is a spurious extra '/' character outside of a comment
90 like so:
91
92 #define SO_REUSEPORT 0x0200 /* allow local address & port
93 reuse */ /
94
95 You could edit that header yourself to remove that last '/', or you
96 might note that Language Environment (LE) APAR PQ39997 describes the
97 problem and PTF's UQ46272 and UQ46271 are the (R8 at least) fixes and
98 apply them. If left unattended that syntax error will turn up as an
99 inability for Perl to build its "Socket" extension.
100
101 For successful testing you may need to turn on the sticky bit for your
102 world readable /tmp directory if you have not already done so (see man
103 chmod).
104
105 Configure Perl on OS/390
106 Once you've unpacked the distribution, run "sh Configure" (see INSTALL
107 for a full discussion of the Configure options). There is a "hints"
108 file for os390 that specifies the correct values for most things. Some
109 things to watch out for include:
110
111 · A message of the form:
112
113 (I see you are using the Korn shell. Some ksh's blow up on Configure,
114 mainly on older exotic systems. If yours does, try the Bourne shell instead.)
115
116 is nothing to worry about at all.
117
118 · Some of the parser default template files in /samples are needed in
119 /etc. In particular be sure that you at least copy
120 /samples/yyparse.c to /etc before running Perl's Configure. This
121 step ensures successful extraction of EBCDIC versions of parser
122 files such as perly.c, perly.h, and x2p/a2p.c. This has to be done
123 before running Configure the first time. If you failed to do so
124 then the easiest way to re-Configure Perl is to delete your
125 misconfigured build root and re-extract the source from the tar
126 ball. Then you must ensure that /etc/yyparse.c is properly in
127 place before attempting to re-run Configure.
128
129 · This port will support dynamic loading, but it is not selected by
130 default. If you would like to experiment with dynamic loading then
131 be sure to specify -Dusedl in the arguments to the Configure
132 script. See the comments in hints/os390.sh for more information on
133 dynamic loading. If you build with dynamic loading then you will
134 need to add the $archlibexp/CORE directory to your LIBPATH
135 environment variable in order for perl to work. See the config.sh
136 file for the value of $archlibexp. If in trying to use Perl you
137 see an error message similar to:
138
139 CEE3501S The module libperl.dll was not found.
140 From entry point __dllstaticinit at compile unit offset +00000194 at
141
142 then your LIBPATH does not have the location of libperl.x and
143 either libperl.dll or libperl.so in it. Add that directory to your
144 LIBPATH and proceed.
145
146 · Do not turn on the compiler optimization flag "-O". There is a bug
147 in either the optimizer or perl that causes perl to not work
148 correctly when the optimizer is on.
149
150 · Some of the configuration files in /etc used by the networking APIs
151 are either missing or have the wrong names. In particular, make
152 sure that there's either an /etc/resolv.conf or an /etc/hosts, so
153 that gethostbyname() works, and make sure that the file /etc/proto
154 has been renamed to /etc/protocol (NOT /etc/protocols, as used by
155 other Unix systems). You may have to look for things like HOSTNAME
156 and DOMAINORIGIN in the "//'SYS1.TCPPARMS(TCPDATA)'" PDS member in
157 order to properly set up your /etc networking files.
158
159 Build, Test, Install Perl on OS/390
160 Simply put:
161
162 sh Configure
163 make
164 make test
165
166 if everything looks ok (see the next section for test/IVP diagnosis)
167 then:
168
169 make install
170
171 this last step may or may not require UID=0 privileges depending on how
172 you answered the questions that Configure asked and whether or not you
173 have write access to the directories you specified.
174
175 Build Anomalies with Perl on OS/390
176 "Out of memory!" messages during the build of Perl are most often fixed
177 by re building the GNU make utility for OS/390 from a source code kit.
178
179 Another memory limiting item to check is your MAXASSIZE parameter in
180 your 'SYS1.PARMLIB(BPXPRMxx)' data set (note too that as of V2R8
181 address space limits can be set on a per user ID basis in the USS
182 segment of a RACF profile). People have reported successful builds of
183 Perl with MAXASSIZE parameters as small as 503316480 (and it may be
184 possible to build Perl with a MAXASSIZE smaller than that).
185
186 Within USS your /etc/profile or $HOME/.profile may limit your ulimit
187 settings. Check that the following command returns reasonable values:
188
189 ulimit -a
190
191 To conserve memory you should have your compiler modules loaded into
192 the Link Pack Area (LPA/ELPA) rather than in a link list or step lib.
193
194 If the c89 compiler complains of syntax errors during the build of the
195 Socket extension then be sure to fix the syntax error in the system
196 header /usr/include/sys/socket.h.
197
198 Testing Anomalies with Perl on OS/390
199 The "make test" step runs a Perl Verification Procedure, usually before
200 installation. You might encounter STDERR messages even during a
201 successful run of "make test". Here is a guide to some of the more
202 commonly seen anomalies:
203
204 · A message of the form:
205
206 comp/cpp.............ERROR CBC3191 ./.301989890.c:1 The character $ is not a
207 valid C source character.
208 FSUM3065 The COMPILE step ended with return code 12.
209 FSUM3017 Could not compile .301989890.c. Correct the errors and try again.
210 ok
211
212 indicates that the t/comp/cpp.t test of Perl's -P command line
213 switch has passed but that the particular invocation of c89 -E in
214 the cpp script does not suppress the C compiler check of source
215 code validity.
216
217 · A message of the form:
218
219 io/openpid...........CEE5210S The signal SIGHUP was received.
220 CEE5210S The signal SIGHUP was received.
221 CEE5210S The signal SIGHUP was received.
222 ok
223
224 indicates that the t/io/openpid.t test of Perl has passed but done
225 so with extraneous messages on stderr from CEE.
226
227 · A message of the form:
228
229 lib/ftmp-security....File::Temp::_gettemp: Parent directory (/tmp/) is not safe
230 (sticky bit not set when world writable?) at lib/ftmp-security.t line 100
231 File::Temp::_gettemp: Parent directory (/tmp/) is not safe (sticky bit not
232 set when world writable?) at lib/ftmp-security.t line 100
233 ok
234
235 indicates a problem with the permissions on your /tmp directory
236 within the HFS. To correct that problem issue the command:
237
238 chmod a+t /tmp
239
240 from an account with write access to the directory entry for /tmp.
241
242 · Out of Memory!
243
244 Recent perl test suite is quite memory hunrgy. In addition to the
245 comments above on memory limitations it is also worth checking for
246 _CEE_RUNOPTS in your environment. Perl now has (in miniperlmain.c)
247 a C #pragma to set CEE run options, but the environment variable
248 wins.
249
250 The C code asks for:
251
252 #pragma runopts(HEAP(2M,500K,ANYWHERE,KEEP,8K,4K) STACK(,,ANY,) ALL31(ON))
253
254 The important parts of that are the second argument (the increment)
255 to HEAP, and allowing the stack to be "Above the (16M) line". If
256 the heap increment is too small then when perl (for example loading
257 unicode/Name.pl) tries to create a "big" (400K+) string it cannot
258 fit in a single segment and you get "Out of Memory!" - even if
259 there is still plenty of memory available.
260
261 A related issue is use with perl's malloc. Perl's malloc uses
262 "sbrk()" to get memory, and "sbrk()" is limited to the first
263 allocation so in this case something like:
264
265 HEAP(8M,500K,ANYWHERE,KEEP,8K,4K)
266
267 is needed to get through the test suite.
268
269 Installation Anomalies with Perl on OS/390
270 The installman script will try to run on OS/390. There will be fewer
271 errors if you have a roff utility installed. You can obtain GNU groff
272 from the Redbook SG24-5944-00 ftp site.
273
274 Usage Hints for Perl on OS/390
275 When using perl on OS/390 please keep in mind that the EBCDIC and ASCII
276 character sets are different. See perlebcdic.pod for more on such
277 character set issues. Perl builtin functions that may behave
278 differently under EBCDIC are also mentioned in the perlport.pod
279 document.
280
281 Open Edition (UNIX System Services) from V2R8 onward does support
282 #!/path/to/perl script invocation. There is a PTF available from IBM
283 for V2R7 that will allow shell/kernel support for #!. USS releases
284 prior to V2R7 did not support the #! means of script invocation. If
285 you are running V2R6 or earlier then see:
286
287 head `whence perldoc`
288
289 for an example of how to use the "eval exec" trick to ask the shell to
290 have Perl run your scripts on those older releases of Unix System
291 Services.
292
293 If you are having trouble with square brackets then consider switching
294 your rlogin or telnet client. Try to avoid older 3270 emulators and
295 ISHELL for working with Perl on USS.
296
297 Floating Point Anomalies with Perl on OS/390
298 There appears to be a bug in the floating point implementation on S/390
299 systems such that calling int() on the product of a number and a small
300 magnitude number is not the same as calling int() on the quotient of
301 that number and a large magnitude number. For example, in the
302 following Perl code:
303
304 my $x = 100000.0;
305 my $y = int($x * 1e-5) * 1e5; # '0'
306 my $z = int($x / 1e+5) * 1e5; # '100000'
307 print "\$y is $y and \$z is $z\n"; # $y is 0 and $z is 100000
308
309 Although one would expect the quantities $y and $z to be the same and
310 equal to 100000 they will differ and instead will be 0 and 100000
311 respectively.
312
313 The problem can be further examined in a roughly equivalent C program:
314
315 #include <stdio.h>
316 #include <math.h>
317 main()
318 {
319 double r1,r2;
320 double x = 100000.0;
321 double y = 0.0;
322 double z = 0.0;
323 x = 100000.0 * 1e-5;
324 r1 = modf (x,&y);
325 x = 100000.0 / 1e+5;
326 r2 = modf (x,&z);
327 printf("y is %e and z is %e\n",y*1e5,z*1e5);
328 /* y is 0.000000e+00 and z is 1.000000e+05 (with c89) */
329 }
330
331 Modules and Extensions for Perl on OS/390
332 Pure pure (that is non xs) modules may be installed via the usual:
333
334 perl Makefile.PL
335 make
336 make test
337 make install
338
339 If you built perl with dynamic loading capability then that would also
340 be the way to build xs based extensions. However, if you built perl
341 with the default static linking you can still build xs based extensions
342 for OS/390 but you will need to follow the instructions in
343 ExtUtils::MakeMaker for building statically linked perl binaries. In
344 the simplest configurations building a static perl + xs extension boils
345 down to:
346
347 perl Makefile.PL
348 make
349 make perl
350 make test
351 make install
352 make -f Makefile.aperl inst_perl MAP_TARGET=perl
353
354 In most cases people have reported better results with GNU make rather
355 than the system's /bin/make program, whether for plain modules or for
356 xs based extensions.
357
358 If the make process encounters trouble with either compilation or
359 linking then try setting the _C89_CCMODE to 1. Assuming sh is your
360 login shell then run:
361
362 export _C89_CCMODE=1
363
364 If tcsh is your login shell then use the setenv command.
365
367 David Fiander and Peter Prymmer with thanks to Dennis Longnecker and
368 William Raffloer for valuable reports, LPAR and PTF feedback. Thanks
369 to Mike MacIsaac and Egon Terwedow for SG24-5944-00. Thanks to Ignasi
370 Roca for pointing out the floating point problems. Thanks to John
371 Goodyear for dynamic loading help.
372
374 INSTALL, perlport, perlebcdic, ExtUtils::MakeMaker.
375
376 http://www-1.ibm.com/servers/eserver/zseries/zos/unix/bpxa1toy.html
377
378 http://www.redbooks.ibm.com/abstracts/sg245944.html
379
380 http://www-1.ibm.com/servers/eserver/zseries/zos/unix/bpxa1ty1.html#opensrc
381
382 http://www.xray.mpe.mpg.de/mailing-lists/perl-mvs/
383
384 http://publibz.boulder.ibm.com:80/cgi-bin/bookmgr_OS390/BOOKS/ceea3030/
385
386 http://publibz.boulder.ibm.com:80/cgi-bin/bookmgr_OS390/BOOKS/CBCUG030/
387
388 Mailing list for Perl on OS/390
389 If you are interested in the VM/ESA, z/OS (formerly known as OS/390)
390 and POSIX-BC (BS2000) ports of Perl then see the perl-mvs mailing list.
391 To subscribe, send an empty message to perl-mvs-subscribe@perl.org.
392
393 See also:
394
395 http://lists.perl.org/showlist.cgi?name=perl-mvs
396
397 There are web archives of the mailing list at:
398
399 http://www.xray.mpe.mpg.de/mailing-lists/perl-mvs/
400 http://archive.develooper.com/perl-mvs@perl.org/
401
403 This document was originally written by David Fiander for the 5.005
404 release of Perl.
405
406 This document was podified for the 5.005_03 release of Perl 11 March
407 1999.
408
409 Updated 28 November 2001 for broken URLs.
410
411 Updated 12 November 2000 for the 5.7.1 release of Perl.
412
413 Updated 15 January 2001 for the 5.7.1 release of Perl.
414
415 Updated 24 January 2001 to mention dynamic loading.
416
417 Updated 12 March 2001 to mention //'SYS1.TCPPARMS(TCPDATA)'.
418
419
420
421perl v5.10.1 2009-02-12 PERLOS390(1)