Tmax Application Development Guide

Tmax v5.0 SP2 Fix #1

Restricted Rights Legend

All TmaxSoft Software (Tmax®) and documents are protected by copyright laws and international convention. TmaxSoft software and documents are made available under the terms of the TmaxSoft License Agreement and may only be used or copied in accordance with the terms of this agreement. No part of this document may be transmitted, copied, deployed, or reproduced in any form or by any means, electronic, mechanical, or optical, without the prior written consent of TmaxSoft Co., Ltd.

Nothing in this software document and agreement constitutes a transfer of intellectual property rights regardless of whether or not such rights are registered) or any rights to TmaxSoft trademarks, logos, or any other brand features.

This document is for information purposes only. The company assumes no direct or indirect responsibilities for the contents of this document, and does not guarantee that the information contained in this document satisfies certain legal or commercial conditions.

The information contained in this document is subject to change without prior notice due to product upgrades or updates. The company assumes no liability for any errors in this document.

Trademarks

Tmax®, Tmax WebtoB® and JEUS® are registered trademark of TmaxSoft Co., Ltd. Other products, titles or services may be registered trademarks of their respective companies.

Open Source Software Notice

Some modules or files of this product are subject to the terms of the following licenses: openssl-0.9.7.m, zlib-1.1.4, expat-2.0.0, netsnmp, DCE1.0, pthread, google-diff-match-patch, libevent, getopt.

Detailed Information related to the license can be found in the following directory: ${INSTALL_PATH}/license/oss_licenses.

Document Information

Document Name: Tmax Application Development Guide

Document Created: 2016-03-31

Software Version: Tmax v5.0 SP2 Fix #1

Document Version: v2.1.5.1


Table of Contents

About This Document
1. Introduction to Tmax Applications
1.1. Overview
1.2. Structure
1.3. Characteristics
2. Client Program
2.1. Characteristics and Components of a Program
2.2. Development Environments and Tools
2.3. Program Flow
2.4. Compiling a Program
2.5. Starting and Terminating a Process
2.5.1. sdlc
2.5.2. fdlc
3. Server Program
3.1. Characteristics and Components of a Program
3.1.1. TCS
3.1.2. UCS
3.2. Development Environments and Tools
3.3. Program Flow
3.3.1. TCS
3.3.2. UCS
3.4. Compiling a Program
3.4.1. TCS
3.4.2. UCS
3.5. Creating and Terminating a Process
4. Communication Mode
4.1. Overview
4.2. Synchronous Communication
4.3. Asynchronous Communication
4.4. Interactive Communication
4.4.1. Events Related to Interactive Communication
5. Buffer Type
5.1. Overview
5.2. Buffer Type
5.3. Managing a Buffer
5.3.1. Structure Buffer
5.3.2. Field Buffer
6. Transaction
6.1. Overview
6.2. Distributed Transaction
6.2.1. XA Mode
6.2.2. Non-XA Mode
6.3. Transaction Errors
6.3.1. TX Error
6.3.2. XA Error
7. Multithread and Multicontext
7.1. Overview
7.2. Client Program
7.2.1. Program Flow
7.2.2. Program Implementation
7.2.3. Program Example
7.3. Server Program
7.3.1. Overview
7.3.2. Program Flow
7.3.3. Program Implementation
7.3.4. Service Processing Program Example
7.3.5. Context Sharing Program Example
8. Security System
8.1. Overview
8.2. Level 1 (System Access Control)
8.3. Level 2 (User Authentication)
8.4. Level 3 (Service Access Control)
9. Client API
9.1. Overview
9.2. Connection and Disconnection
9.2.1. tpstart
9.2.2. tpend
9.3. Synchronous Communication
9.3.1. tpcall
9.4. Asynchronous Communication
9.4.1. tpacall
9.4.2. tpgetrply
9.4.3. tpcancel
9.5. Interactive Communication
9.5.1. tpconnect
9.5.2. tpsend
9.5.3. tprecv
9.5.4. tpdiscon
9.6. Unsolicited Message Process
9.6.1. tpsetunsol
9.6.2. tpgetunsol
9.7. Timeout Change
9.7.1. tpset_timeout
9.7.2. tpsetsvctimeout
9.8. Buffer Management
9.8.1. tpalloc
9.8.2. tprealloc
9.8.3. tpfree
9.8.4. tptypes
9.9. Transaction Management
9.9.1. tx_begin
9.9.2. tx_commit
9.9.3. tx_info
9.9.4. tx_rollback
9.9.5. tx_set_transaction_timeout
9.9.6. tx_set_transaction_control
9.9.7. tx_set_commit_return
9.10. RQ System
9.10.1. tpenq
9.10.2. tpdeq
9.10.3. tpqstat
9.10.4. tpextsvcname
9.11. API that Uses Events
9.11.1. tpsubscribe
9.11.2. tpunsubscribe
9.11.3. tppost
9.12. Broadcast/Multicast
9.12.1. tpbroadcast
9.13. Environment Program
9.13.1. WinTmaxAcall
9.13.2. WinTmaxAcall2
9.13.3. WinTmaxStart
9.13.4. WinTmaxEnd
9.13.5. WinTmaxSetContext
9.13.6. WinTmaxSend
9.14. Multithread/Multicontext
9.14.1. tpgetctxt
9.14.2. tpsetctxt
10. Server API
10.1. TCS
10.1.1. tpreturn
10.1.2. tpforward
10.1.3. tpsvrinit
10.1.4. tpsvrdone
10.1.5. tpsvrthrinit
10.1.6. tpsvrthrdone
10.1.7. tpgetctxt
10.1.8. tpsetctxt
10.1.9. tpsendtocli
10.1.10. tpgetclid
10.1.11. tpchkclid
10.2. UCS
10.2.1. tpschedule
10.2.2. tpuschedule
10.2.3. tpsetfd
10.2.4. tpissetfd
10.2.5. tpclrfd
10.2.6. tpsavectx
10.2.7. tpgetctx
10.2.8. tpcancelctx
10.2.9. tprelay
10.2.10. tpregcb
10.2.11. tpunregcb
11. Error Handling
11.1. Overview
11.2. API Level Error Processing
11.2.1. tpstrerror
11.3. System Level Error Processing
11.3.1. Uunixerr
11.3.2. Uunix_err
11.3.3. Ustrerror
11.4. Debug
11.4.1. Debug CLH
11.4.2. Debug Library
12. Examples
12.1. Examples of Communication Mode
12.1.1. Synchronous Communication
12.1.2. Asynchronous Communication
12.1.3. Interactive Communication
12.2. Examples of a Global Transaction Program
12.3. Database Program
12.3.1. Oracle Insert Program
12.3.2. Oracle Select Program
12.3.3. Informix Insert Program
12.3.4. Informix Select Program
12.4. Database Integration Program
12.4.1. Synchronous Mode (Homogeneous Database)
12.4.2. Synchronous Mode (Heterogeneous Database)
12.4.3. Asynchronous Mode (Homogeneous Database)
12.4.4. Interactive Mode (Homogeneous Database)
12.5. Program Using TIP
12.5.1. TIP Structure
12.5.2. TIP Usage
12.5.3. TIP Usage Example
12.5.4. Program for Checking System Environment Information
12.5.5. Program for Checking System Statistical Information
12.5.6. Program for Starting and Terminating a Server Process
12.6. Local Recursive Call
A. Configuring Tmax
A.1. Configuration File
A.1.1. DOMAIN Section
A.1.2. NODE Section
A.1.3. SVRGROUP Section
A.1.4. SERVER Section
A.1.5. SERVICE Section
A.2. Makefile
Index

List of Figures

[Figure 1.1] Tmax Application Program
[Figure 2.1] Client Program Flow
[Figure 2.2] Process of Functions in a Client Program
[Figure 2.3] Compiling a Client Program Using a Struct Buffer
[Figure 2.4] Compiling a Client Program Using a Fielded Buffer
[Figure 3.1] Tmax Server Processes
[Figure 3.2] Server Program's Flow
[Figure 3.3] TCS type Server Program's Flow
[Figure 3.4] UCS Type Server Program's Flow
[Figure 3.5] Compiling a Server Program Using a Structure Buffer
[Figure 3.6] Compiling a Server Program Using a Field Buffer
[Figure 4.1] Synchronous Communication
[Figure 4.2] Synchronous Mode
[Figure 4.3] Asynchronous Communication
[Figure 4.4] Asynchronous Mode
[Figure 4.5] Interactive Communication
[Figure 4.6] Interactive Mode
[Figure 5.1] Tmax Communication Buffer Types
[Figure 5.2] Compiling an Application Program that Uses a Structure Buffer
[Figure 5.3] Compiling an Application Program that Uses a Field Buffer
[Figure 6.1] 2PC (2 Phase Commit) Protocol
[Figure 6.2] X/Open DTP Structure
[Figure 6.3] The Process of Distributed Transactions
[Figure 6.4] XA Mode
[Figure 6.5] Non-XA Mode
[Figure 7.1] Tmax Client Multithread Application
[Figure 7.2] Tmax Client Multicontext Application
[Figure 7.3] Tmax Server Multithread Application
[Figure 7.4] Tmax Server Multicontext Application
[Figure 10.1] tpforward
[Figure 10.2] UCS Type Service Forwarding
[Figure 12.1] Access to 2 Databases
[Figure 12.2] Synchronous Mode Flow (Homogeneous Database)
[Figure 12.3] Synchronous mode Flow (Heterogeneous Database)
[Figure 12.4] Asynchronous Mode Flow (Homogeneous Database)
[Figure 12.5] Interactive Mode Flow (Homogeneous Database)