Skip to main content

     
  TPF : Support : Tools
  Products > Software > Host Transaction Processing > TPF > Tools >

IBM Transaction Processing Facility (TPF) V4R1:
Using Perl on TPF
README


CONTENTS

1.0   ABOUT THIS README FILE
1.1 Who should read this README file
1.2 How to get help
2.0 PERL SUPPORT ON TPF (includes Table of TPF-Supported Perl Features)
3.0 GETTING THE PERL CODE FOR TPF
3.1 Downloading
3.2 Extracting
4.0 COMPILING PERL FOR TPF
4.1 Building Miniperl for OS/390 UNIX
4.2 Building Perl for TPF
5.0 INSTALLATION
6.0 TESTING PERL
6.1 Setup
6.2 My First Perl Script
7.0 TECHNICAL DOCUMENTATION AND OTHER SOURCES OF INFORMATION
8.0 NOTICES
8.1 Permission Notices
8.2 Trademarks

1.0 ABOUT THIS README FILE

This file contains the latest information for installing the Perl scripting language on a TPF system and was last updated on 30 November 2000. See section 2.0 Perl Support on TPF for important version support information.

The procedures described in this document have been tested on an OS/390 UNIX System Services machine running at version 2.6 that contained both OS/390 UNIX and TPF C header files. Throughout this document, we will refer to this machine as OS/390 UNIX.

The following conventions are used in this document:

  • Text that you type is shown in bold and is case sensitive.
  • Sample output is shown in monospaced font.
Note: Information about Perl is available on several Web sites. Some resources are identified in 7.0 Technical Documentation and Other Sources of Information.

1.1 Who should read this README file

This file is intended for those persons who are installing Perl. Those who are using the Perl code and writing Perl scripts can learn more about Perl and the TPF file system through the resources identified in 7.0 Technical Documentation and Other Sources of Information.

1.2 How to get help

If you have difficulty installing Perl, contact your TPF service representative.

[top]


2.0 PERL SUPPORT ON TPF

To use Perl on your TPF system, you must be at TPF V4R1 PUT 13 with APAR PJ27277 installed. TPF only supports Perl version 5.005_03, which is available on the TPF Web page. See 3.0 Getting the Perl Code for TPF for more information about getting the appropriate Perl code.

The following extensions are supported in part or in full on the TPF system:

  • Errno
  • Fcntl
  • IO
  • Opcode
  • POSIX
  • Socket
Process handling of Perl scripts on TPF varies from UNIX because of differences between the models for creating subprocesses: TPF uses tpf_fork while UNIX uses fork and exec.

TPF supports many, but not all, built-in Perl functions and Perl switches. The Table of TPF-Supported Perl Features identifies which functions and which switches are supported.

[top]


3.0 GETTING THE PERL CODE FOR TPF

Before using Perl on your TPF system, you will need to first download the Perl code from the TPF Web site and then extract the files.

3.1 Downloading

To download the Perl code for TPF, do the following:
  1. Go to the TPF Web Page and click TPF Tools or go directly to http://www.s390.ibm.com/tpf/tools.htm.

  2. Download the Perl source code (perl5.005_03.source_code.tar.Z) and the patches that enable Perl to run on your TPF system (perl5.005_03.tpf_patches.tar.Z) by doing the following:

    1. Download each archive to your PC or workstation by clicking the file name and then choosing an appropriate directory. (The instructions that follow assume you have downloaded the archives to your local C:\ drive.) Make sure that you use the .tar.Z extension on the file names. Sometimes browsers do not understand the file extensions and attempt to save the file with a different extension so you may need to reset the file extension to .tar.Z.

    2. Use FTP to send the archives to your OS/390 UNIX system by doing the following:

      1. Open a DOS window.

      2. Enter ftp your.open.edition.machine.com to activate FTP, where your.open.edition.machine.com is the name of your OS/390 UNIX system.

      3. Sign in.

      4. Enter binary to set the session as binary.

      5. Enter send c:\perl5.005_03.source_code.tar.Z perl5.005_03.source_code.tar.Z to send the Perl source code to your OS/390 UNIX system.

      6. Enter send c:\perl5.005_03.tpf_patches.tar.Z perl5.005_03.tpf_patches.tar.Z to send the patches to your OS/390 UNIX system.

      7. Enter bye to exit FTP.

      8. Close the DOS window.
(You can also download Perl source code from CPAN: the Comprehensive Perl Archive Network. However, because the patches required for Perl to run on TPF are specific to version 5.005_03, download the Perl source code from the TPF Web site to ensure compatibility.)

3.2 Extracting

Each archive is compressed into a tarball. To extract the files from these tarballs, do the following on your OS/390 UNIX system:
  1. Ensure both archives are in the same directory on OS/390 UNIX.

  2. Enter gunzip perl5.005_03.source_code.tar.Z to decompress the Perl source code. The tar.Z file is replaced by the .tar archive file.

  3. Enter gunzip perl5.005_03.tpf_patches.tar.Z to decompress the patches. The tar.Z file is replaced by the .tar archive file.

  4. Enter pax -rvkf perl5.005_03.source_code.tar -o from=ISO8859-1,to=IBM-1047 to extract the Perl source code.*

  5. Enter pax -rvkf perl5.005_03.tpf_patches.tar -o from=ISO8859-1,to=IBM-1047 to extract the patches.*

  6. Enter chmod -R 777 perl5.005_03 to ensure all files are accessible.

  7. Enter cp -R perl5.005_03/tpf/* perl5.005_03 to apply the TPF patches by overlaying selected Perl files.
* Notes for steps 4 and 5:
  • Using the pax command will extract the files and translate them from ASCII (ISO8859-1) to EBCDIC (IBM-1047).

  • Enter pax -vf archive.tar, where archive is the file name of either the Perl source code or the patches, to view the contents of an archive without extracting any files.

  • The files extracted from these two archives are automatically placed in a new perl5.005_03 subdirectory.

  • The -k option for the pax command prevents the extract from overlaying any existing files or directories. As a result, you will receive (and you can ignore) the following error message after the second entry:
    FSUM9679 Existing file "perl5.005_03/" exists; it will not be overwritten
[top]

4.0 COMPILING PERL FOR TPF

The unique Perl build process uses a small version of itself called miniperl to complete the Perl interpreter. This causes problems on systems that do cross-platform compiling, such as TPF. As a result, to compile Perl for TPF, you will first need to create miniperl so that it runs on OS/390 UNIX and then force a complete build against TPF headers and libraries.

The build for TPF should not interfere with any existing implementations of Perl on OS/390 UNIX nor will it write into the /usr/local directory.

4.1 Building miniperl for OS/390 UNIX

To create miniperl, do the following:
  1. Enter cd perl5.005_03 to change to the perl5.005_03 directory.

  2. Enter Configure -des to kick off the configuration process. This will take approximately 20 to 30 minutes to be completed but requires no interaction. Your output will be similar to the following:
    (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.)
    First let's make sure your kit is complete. Checking...
    Locating common programs...
    Checking compatibility between /bin/echo and builtin echo (if any)...
    
    (... several screens of output here ...)

    Finding dependencies for walk.o. echo Makefile.SH cflags.SH | tr ' ' '\n' >.shlist Updating makefile... Now you must run a make. If you compile perl5 on a different machine or from a different object directory, copy the Policy.sh file from this object directory to the new one before you run Configure -- this will help you with most of the policy defaults.

    You can safely ignore the following error (or diagnostic) messages:

    /bin/awk: Syntax error Context is:
    >>>      {print $}      <<<
    
    perly.y -> perly.c
    perly.y -> perly.h
    a2p.y -> a2p.c
    
    ERROR CBC3198 ./.nnnnnnnn.c:399 #if, #else, #elif, #ifdef, #ifndef block must be ended with #endif.
    FSUM3065 The COMPILE step ended with return code 12.
    FSUM3017 Could not compile .nnnnnnnn.c. Correct the errors and try again.
    
  3. Enter make miniperl to compile miniperl for OS/390 UNIX. Your output will be similar to the following:
    `sh cflags libperl.a miniperlmain.o` miniperlmain.c
              CCMD = c89 -DPERL_CORE -c -DMAXSIG=38 -DOEMVS -D_OE_SOCKETS -D_XOPEN
    `sh cflags libperl.a perl.o` perl.c
              CCCMD = c89 -DPERL_CORE -c -DMAXSIG=38 -DOEMVS -D_OE_SOCKETS -D_XOPEN
    
    (... several screens of output here ...)
    `sh cflags libperl.a ebcdic.o` ebcdic.c
              CCCMD = c89 -DPERL_CORE -c -DMAXSIG=38 -DOEMVS -D_OE_SOCKETS -D_XOPEN
    rm -f libperl.a
    /bin/ar rcu libperl.a perl.o gv.o toke.o perly.o op.o regcomp.o dump.o util.o m
        c89 -L/usr/local/lib -o miniperl miniperlmain.o libperl.a -lm -lc
        ./miniperl -w -Ilib -MExporter -e 0 || make minitest
    

4.2 Building Perl for TPF

Once miniperl has been built for OS/390 UNIX, you can build the complete Perl interpreter for TPF by doing the following:
  1. Ensure you are in the perl5.005_03 directory.

  2. Customize the tpf.exports script by putting in the location of your TPF C header files. This script will set the environment variables required to compile Perl for TPF.

  3. Verify that the export variables are valid for your installation; in particular, the system include file directories. The system include files must reside on your OS/390 UNIX system in the appropriate file structure similar to /usr/include and /usr/include/sys. If your system header files contain line numbers in columns 72–80, you must truncate them. The lines that read export _C89_OPTIONS="-W 0,langlvl(extended) -DSTANDARD_C" and export TPF=YES are required for the Perl compilation to work correctly.

    This example from a customer shows the commands used for the copy process from PDS to HFS:

    mkdir -m 755 /usr/include
    mkdir -m 755 /usr/include/sys
    tso OPUTX "'TPF.CHDR.REL41.LRECL72' '/usr/include/' LC SUFFIX(h)"
    cp -m /usr/include/types.h /usr/include/sys
    cp -m /usr/include/stat.h /usr/include/sys
    cp -m /usr/include/cdefs.h /usr/include/sys
    cp -m /usr/include/ioctl.h /usr/include/sys
    cp -m /usr/include/modes.h /usr/include/sys
    cp -m /usr/include/wait.h /usr/include/sys
    cp -m /usr/include/ipc.h /usr/include/sys
    cp -m /usr/include/shm.h /usr/include/sys
    cp -m /usr/include/socket.h /usr/include/sys

  4. Enter . tpf.exports to export TPF compiler settings.
    The initial period and blank are required to ensure the environment variables exist beyond the scope of the tpf.exports shell script. If you receive either of the following error messages, go back to 4.1 Building miniperl for OS/390 UNIX and complete the miniperl build:

    • tpf.exports: run "Configure -des" first

    • tpf.exports: run "make miniperl" first"

    Once a successful export of the TPF compiler settings has been completed, you cannot rebuild miniperl for OS/390 UNIX without first clearing the settings. If you must rebuild miniperl, exit and then log on again to clear the settings.

  5. To customize the config.sh.tpf file, do the following:

    1. Change the /u/tpf41/currentmaint/include string to reflect your TPF C header directory on the following lines:

      • strings='/u/tpf41/currentmaint/include/string.h'

      • timeincl='/u/tpf41/currentmaint/include/sysgtime.h'

      • usrinc='/u/tpf41/currentmaint/include'

    2. On the perladmin='someone@your.company.com' line, change the e-mail address to a valid address.
    3. Customize the information within single quotation marks (' ') on the following lines with the appropriate information:

      • cf_by='your name'

      • cf_email='you@your.company.com'

      • cf_time='Thu Sep 2 14:34:27 EDT 1999'

    4. You have the option to exclude the Errno, Fcntl, IO, Opcode, POSIX, or Socket extensions. To do this, modify the following line by deleting the extension you want to exclude:

      extensions='Errno Fcntl IO Opcode POSIX Socket'

  6. Enter cp config.sh.tpf config.sh to overlay the generated OS/390 UNIX config.sh file with the TPF config.sh.tpf file.
    If you must rebuild miniperl for OS/390 UNIX, delete config.sh first to force it to be generated again with OS/390 UNIX values. You also must exit and log on again to clear the TPF settings made by tpf.exports.

  7. Enter tpf.setup to run a shell script to set up for rebuilding against TPF headers and libraries. Your output will be similar to the following:

    ./tpf.setup: removing specific files to force rebuild
    ./tpf.setup: running .SH scripts
    Extracting Makefile (with variable substitutions)
    Extracting Policy.sh (with variable substitutions)
    Extracting cflags (with variable substitutions)
    Extracting makeaperl (with variable substitutions)
    Extracting makedepend (with variable substitutions)
    Extracting makedir (with variable substitutions)
    Extracting perl.exp
    Extracting writemain (with variable substitutions)
    Extracting config.h (with variable substitutions)
    Extracting x2p/Makefile (with variable substitutions)
    Extracting x2p/cflags (with variable substitutions)
    ./tpf.setup: touching .c files to force recompiles against TPF
    ./tpf.setup: completed
    

  8. Enter make tpf to compile Perl for TPF. Your output will be similar to the following:
    `sh cflags libperl.a perl.o` perl.c
              CCCMD = c89 -DPERL_CORE -c -DTPF -D_OE_SOCKETS -D_XOPEN_SOURCE_EXTEND
    `sh cflags libperl.a gv.o` gv.c
              CCCMD = c89 -DPERL_CORE -c -DTPF -D_OE_SOCKETS -D_XOPEN_SOURCE_EXTEND
    ... several screens of output here ...
              Making Errno (nonxs)
    Writing Makefile for Errno
    mkdir ../../lib/auto/Errno
    ../../miniperl -I../../lib -I../../lib -I../../lib -I../../lib Errno_pm.PL Errno.pm
    cp Errno.pm ../../lib/Errno.pm
    

    You can safely ignore the following error message:

    ERROR CBC3198 ./.nnnnnnnn.c:399 #if, #else, #elif, #ifdef, #ifndef block must be ended with #endif.
    FSUM3065 The COMPILE step ended with return code 12.
    FSUM3017 Could not compile .nnnnnnnn.c. Correct the errors and try again.
    
[top]

5.0 INSTALLATION

To install Perl on your TPF system, do the following:
    Note: Program CHTP has been reserved to allow it to be used for Perl to avoid naming conflicts. If you prefer to use another program name, replace CHTP with your program name.

  1. Link the generated Perl object files. Sample link JCL (contained in the linkperl.jcl file) has been included with the TPF patches as an example. You must change the IDs, data set names, and libraries for your particular site.

  2. Create a loadset. Sample loadset JCL (contained in the lsetperl.jcl file) has also been included. You must also modify it for your particular site. A JCL condition code of 4 is expected because the C load module will contain no link map data.

  3. Enter the ZOLDR LOAD and ZOLDR ACT functional messages to load and activate the loadset on your test system. (See TPF Operations for more information about the ZOLDR LOAD and ZOLDR ACT functional messages.)
[top]

6.0 TESTING PERL

To test the installation of the Perl code, first complete a setup and then try running your first Perl script.

6.1 Setup

Perl must be associated with a program name. Do this by creating a small file in the /usr/bin directory on your TPF system:
  1. Enter zfile mkdir /usr to make the directory /usr.

  2. Enter zfile mkdir /usr/bin to make the directory /usr/bin.

  3. Enter zfile echo "#!CHTP" > /usr/bin/perl to associate the CHTP program with perl. Your output will be as follows:
    FILE0003I 13.06.55 echo "#!CHT... COMPLETED
    SUCCESSFULLY. NO OUTPUT TO DISPLAY
    
    Additionally, entering zfile cat /usr/bin/perl will return the following:
    FILE0001I 00.31.45 START OF DISPLAY FROM cat /usr/bin/perl
    #!CHTP
    END OF DISPLAY
    

    Note: If your output differs from the pervious examples, your test terminal may be assigning special meanings to the double quotation marks ("), the hash symbol (#), or both.

  4. Enter zfile chmod 777 /usr/bin/perl to turn on permission bits for the newly created file.

6.2 My First Perl Script

To complete the test, enter zfile perl -e 'print "Hello, World!\n";' to pass Perl a script on the command line. Your output will be similar to the following:
FILE0001I 13.08.47 START OF DISPLAY FROM /usr/bin/perl -e 'print "Hello, Wor...
Hello, World!
END OF DISPLAY
You will also get the same results by running a Perl script that you create:
  1. Enter zfile echo 'print "Hello, World!\n";' > hello.pl to create this simple Perl script directly on TPF.

  2. Enter zfile chmod 777 hello.pl to mark the script as executable.

  3. Enter zfile perl hello.pl to execute the script. You will get the following results:
            FILE0001I 01.06.39 START OF DISPLAY FROM perl hello.pl
            Hello, World!
            END OF DISPLAY
            
[top]

7.0 TECHNICAL DOCUMENTATION AND OTHER SOURCES OF INFORMATION

You can learn more about the Perl scripting language through a variety of resources, including books, Web sites, and classes. The
www.perl.com Web site will help you to get started and includes a list of additional resources.

Technical documentation for APAR PJ27277 (file system tools) can be found in TPF Family Libraries. For an online version of the books, go to the TPF Family Libraries section of the TPF Web site or go directly to http://www.s390.ibm.com/products/tpf/tpfid/tpfpubs.htm. The following books were updated for APAR PJ27277:

  • TPF Application Programming
  • TPF C/C++ Language Support User's Guide
  • TPF Library Guide
  • TPF Migration Guide: Program Update Tapes
  • TPF Operations
  • TPF System Macros
[top]

8.0 NOTICES

References in this book to IBM products, programs, or services do not imply that IBM intends to make these available in all countries in which IBM operates. Any reference to an IBM product, program, or service in this book is not intended to state or imply that only IBM's product, program, or service may be used. Any functionally equivalent product, program, or service that does not infringe any of IBM's intellectual property rights may be used instead of the IBM product, program, or service. Evaluation and verification of operation in conjunction with other products, except those expressly designated by IBM, is the user's responsibility. IBM may have patents or pending patent applications covering subject matter in this document. The furnishing of this document does not give you any license to these patents. You can send license inquiries, in writing, to:

IBM Director of Licensing
IBM Corporation
North Castle Drive
Armonk, NY 10504-1785
USA

Licensees of this program who wish to have information about it for the purpose of enabling: (i) the exchange of information between independently created programs and other programs (including this one) and (ii) the mutual use of the information which has been exchanged, should contact:

IBM Corporation
Department 830A
Mail Drop P131
2455 South Road
Poughkeepsie, NY 12601-5400
USA

Such information may be available, subject to appropriate terms and conditions, including in some cases, payment of a fee.

8.1 Permission Notices

The following acknowledges software from other sources:
  • This software and documentation is based in part on the Fourth Berkeley Software Distribution under license from The Regents of the University of California. We acknowledge the following individuals and institutions for their role in its development: The Regents of the University of California and the Electrical Engineering and Computer Sciences Department at the Berkeley Campus of the University of California.

    Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

    1. Redistribution of source code must retain the copyright notice which appears in the source code, this list of conditions and the following disclaimer.
    2. Redistributions in binary form must reproduce the copyright notice which appears in the source code, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
    3. All advertising materials mentioning features or use of this software must display the following acknowledgment:

      This product includes software developed by the University of California, Berkeley, and its contributors.

    4. Neither the name of the University nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

    THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENTS OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS, OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

  • This package is built upon the SGI Standard Template Library (STL) public distribution (v3.0, Oct. 28, 1997), which is:

    Copyright 1994 Hewlett-Packard Company.

    Copyright 1996, 1997 Silicon Graphics Computer Systems, Inc.

    That material is provided pursuant to the following permission notices:

    • Permission to use, copy, modify, distribute and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appears in all copies and that both that copyright notice and this permission notice appear in supporting documentation. Hewlett-Packard Company makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty.
    • Permission to use, copy, modify, distribute and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appears in all copies and that both that copyright notice and this permission notice appear in supporting documentation. Silicon Graphics makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty.
    The adaptation is:
    Copyright 1997 Moscow Center for SPARC Technology.
    You may freely use, copy, modify, or distribute this software and its documentation for any purpose, provided that both the copyright notice and permission notices from Silicon Graphics & Hewlett-Packard and this copyright notice and permission notice appear in all copies. Moscow Center for SPARC Technology makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty.

8.2 Trademarks

The following terms are trademarks of the IBM Corporation in the United States or other countries or both:
  • IBM
  • MVS
  • OS/390 UNIX
  • OS/390
Microsoft, Windows, Windows NT, and the Windows logo are registered trademarks of Microsoft Corporation in the United States, other countries, or both.

UNIX is a registered trademark of The Open Group in the United States and other countries.

Other company, product, and service names may be trademarks or service marks of others.

[top]

© Copyright International Business Machines Corporation 2000. All rights reserved.
US Government Users Restricted Rights — Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.