Installation instructions for TETlib on AS/400
==============================================

Please observe the notes in the TETlib manual regarding expected
file formats (EBCDIC text vs. ASCII text vs. binary) for several
items related to TETlib usage. These rules must strictly be observed
in order to successfully use TETlib on EBCDIC-based platforms.


TETlib is delivered as a SRVPGM for the AS/400 which works with
any ILE language. The respective INCLUDE/COPY sources for
ILE/RPG and ILE/C are included in the package.

Note: PASE is not required for using TETlib on the AS/400.

This document describes the installation steps for TETlib on the AS/400.
TETlib can be installed by using the installation package which is
available from http://www.pdflib.com.


Step 1: Download and unzip the TETLIB.ZIP file
===============================================

Download the file TETLIB_<version>.ZIP for AS/400 and save it to your local
hard disk. Unzip this file to your local hard disk.

Make sure that you have FTP access to your AS/400 and that your user
profile has QSECOFR authority to perform the installation steps.


Step 2: Transfer the TETlib save file to the AS/400
===================================================

Start a DOS session on your PC, and initiate an FTP session against your
AS/400 executing the following command from your DOS prompt:

      FTP myAS400

Enter your AS/400 user profile and password for the logon.

Switch over to binary mode by running the FTP command:
	bin

Create a SAVF on your AS/400 by running the FTP command:
	Quote rcmd crtsavf file(qgpl/tetlib)

Transfer the file TETLIB.SAV to your AS/400 by running the FTP command:
	Put c:\yourlocalpath\tetlib.sav qgpl/tetlib

Exit the FTP session with the FTP command 
	Quit


Step 3: Restoring the TETlib library
====================================

You can now restore the TETLIB objects by running the following CL commands:

	CRTLIB LIB(TETLIB)
	RSTOBJ OBJ(*ALL) SAVLIB(TETLIB) DEV(*SAVF) SAVF(QGPL/TETLIB)


Step 4: Creating the IFS directories and resource files
=======================================================

After restoring all objects to the TETLIB library, execute the following
CL command to create the IFS directories for TETFLIB including all resource
files needed to run TETlib.

	CALL PGM(TETLIB/TETCRTRSC)


Step 6: Verifying the installation
================================== 

After running all installation steps you should have the following objects
in your TETLIB library:

Object      Type      Attribute
                              
TETCRTRSC   *PGM        CLE         TETlib <version> - Install Resource Fil 
TET_JAVA    *SRVPGM     CLE         TETlib <version> - JNI Service Program  
TETLIB      *SRVPGM     CLE         TETlib <version> - TETlib Service Progr 
H           *FILE       PF-SRC      TETlib <version> - H includes           
QCSRC       *FILE       PF-SRC      TETlib <version> - C Samples            
QRPGLESRC   *FILE       PF-SRC      TETlib <version> - RPGLE Samples        
TETLIBRSC   *FILE       SAVF        TETlib <version> - Resource SAVF        
TETLIB      *BNDDIR                 TETlib <version> - Binding Directory    


In the IFS you should find the following directory:

/pdflib/TET-<version>/bind/c
/pdflib/TET-<version>/bind/cpp
/pdflib/TET-<version>/bind/java
/pdflib/TET-<version>/bind/rpg
/pdflib/TET-<version>/doc
/pdflib/TET-<version>/resource


In this directory TETlib stores the resource files needed to use TETlib.


Additional steps for Java
=========================

Make sure that the TETLIB and TET_JAVA SRVPGM can be found in the library
list of the jobs running your Java apps. The easiest way to achieve this
is to copy these SRVPGMs to the QGPL library. In most cases this library
is found in every LIBL.

Make sure that you have execution permission on the Java objects and
directories to run the Java samples.


TETlib applications and Teraspace
=================================

Starting with Version V4R4M0 of OS400, IBM added new functions
for memory allocation (malloc etc.) that allow to allocate more than
16 MB of memory. These new memory functions return teraspace pointers.

Depending on the application's needs, TETlib needs to allocate more than
16 MB. For this reason you must compile TETlib applications with the
*TSIFC option.  If you compile TETlib without Teraspace support you may
get unpredictable results.

In order to use these new functions specify
TERASPACE(*YES *TSIFC)
in the CRTCMOD command.

Programs/modules/service programs compiled under an earlier OS versions
can't handle these teraspace pointers. In order to let them work with
teraspace pointers, you need to recompile them with the option
TERASPACE(*YES).

If you define TERASPACE(*NO) or if you don't recompile, you will receive
a pointer exception as soon as TETlib returns any teraspace pointer to
your application.

Starting with version V5R0M0 of OS400 you can also use teraspace for the
static and automatic storage in your programs. You would use
STGMDL(*TERASPACE) to force any programs or modules to use teraspace
for static or automatic memory.

Because this version of TETlib runs under V4R5M0 which does not support
STGMDL(*TERASPACE) and TETlib may work with fewer than 16MB of
static/automatic storage, TETlib uses STGMDL(*SNGLVL).

For this reason you always have to compile your programs using TETlib with

STGMDL(*SNGLVL) -> for static/automatic storage (>=V5R0M0 only)
TERASPACE(*YES) -> to support teraspace pointers (returned by TETlib)


TETlib application and large file support
=========================================

OS400 supports file sizes of >2GB starting with version V5R1M0. Because the lowest
OS400 release for this version of TETlib is V4R5M0, it does not support large files. 