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