Tmax Getting Started Guide Tmax 3.8 Tmax Getting Started Guide

Similar documents
Tmax COBOL Guide : TMCG : Tmax 3.8 : July 31, 2003 : Sep 20, 2003

Microsoft Word - Tmax Getting Started Guide.doc

Tmax FDL Reference Manual : TMFR : Tmax 3.8 : Sep 20, 2003 : Sep 20, 2003

13주-14주proc.PDF

JEUS WebT Copyright 2004 Tmax Soft Co., Ltd. All Rights Reserved.

목차 1. 환경변수 OS별환경변수설정 ESQL 시작 ESQL 프로그램생성젃차 오라클 Pro*C 젂환 Precompiler 변경 확장자 *.pc를 *.tbc로변경

PCServerMgmt7

6주차.key

PowerPoint 프레젠테이션

기타자료.PDF

ORANGE FOR ORACLE V4.0 INSTALLATION GUIDE (Online Upgrade) ORANGE CONFIGURATION ADMIN O

1217 WebTrafMon II

Microsoft Word - Tmax Application Development Guide.doc

À©µµ³×Æ®¿÷ÇÁ·Î±×·¡¹Ö4Àå_ÃÖÁ¾

<C0CCBCBCBFB52DC1A4B4EBBFF82DBCAEBBE7B3EDB9AE2D D382E687770>

untitled

Sena Technologies, Inc. HelloDevice Super 1.1.0

Chap7.PDF

PowerPoint 프레젠테이션

목차 BUG offline replicator 에서유효하지않은로그를읽을경우비정상종료할수있다... 3 BUG 각 partition 이서로다른 tablespace 를가지고, column type 이 CLOB 이며, 해당 table 을 truncate

Backup Exec


Tmax Programming Guide ( UCS ) Tmax 38 Tmax Programming Guide (UCS)

Intra_DW_Ch4.PDF

final_thesis


MS-SQL SERVER 대비 기능


PowerPoint 프레젠테이션

The Self-Managing Database : Automatic Health Monitoring and Alerting

ETL_project_best_practice1.ppt

untitled

chap7.key

Microsoft Word - Tmax Programming Guide _ UCS _.doc

thesis

MAX+plus II Getting Started - 무작정따라하기

Interstage5 SOAP서비스 설정 가이드

rmi_박준용_final.PDF

PowerPoint 프레젠테이션

<49534F C0CEC1F520BBE7C8C4BDC9BBE720C4C1BCB3C6C320B9D D20BDC3BDBAC5DB20B0EDB5B5C8AD20C1A6BEC8BFE4C3BBBCAD2E687770>

PRO1_04E [읽기 전용]

thesis


PWR PWR HDD HDD USB USB Quick Network Setup Guide xdsl/cable Modem PC DVR 1~3 1.. DVR DVR IP xdsl Cable xdsl Cable PC PC DDNS (

歯이시홍).PDF

NoSQL

untitled

J2EE & Web Services iSeminar

Microsoft PowerPoint - Smart CRM v4.0_TM 소개_ pptx

K&R2 Reference Manual 번역본

강의10

USB USB DV25 DV25 REC SRN-475S REC SRN-475S LAN POWER LAN POWER Quick Network Setup Guide xdsl/cable Modem PC DVR 1~3 1.. DVR DVR IP xdsl Cable xdsl C

SMB_ICMP_UDP(huichang).PDF

Tmax 4Gl Programming Guide (Power Builder, Delphi, Visual Basic, Visual Basic.net, C#.net) Tmax 3.8 Tmax 4GL Programming Guide


자바-11장N'1-502

Chap06(Interprocess Communication).PDF

Voice Portal using Oracle 9i AS Wireless

MySQL-Ch10

Solaris Express Developer Edition

bn2019_2

02 C h a p t e r Java

vm-웨어-01장

PowerChute Personal Edition v3.1.0 에이전트 사용 설명서

solution map_....

기술 이력서 2.0

BSC Discussion 1

(Asynchronous Mode) ( 1, 5~8, 1~2) & (Parity) 1 ; * S erial Port (BIOS INT 14H) - 1 -

T100MD+

10.

Connection 8 22 UniSQLConnection / / 9 3 UniSQL OID SET

untitled

Intro to Servlet, EJB, JSP, WS

PowerPoint 프레젠테이션

untitled

F1-1(수정).ppt

PowerPoint 프레젠테이션

ARMBOOT 1

vm-웨어-앞부속

untitled

Oracle Database 10g: Self-Managing Database DB TSC

Analyst Briefing

Analytics > Log & Crash Search > Unity ios SDK [Deprecated] Log & Crash Unity ios SDK. TOAST SDK. Log & Crash Unity SDK Log & Crash Search. Log & Cras

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션

초보자를 위한 C++

본 강의에 들어가기 전

PowerPoint

VZ94-한글매뉴얼

Deok9_Exploit Technique

hd1300_k_v1r2_Final_.PDF

프로그램을 학교 등지에서 조금이라도 배운 사람들을 위한 프로그래밍 노트 입니다. 저 역시 그 사람들 중 하나 입니다. 중고등학교 시절 학교 도서관, 새로 생긴 시립 도서관 등을 다니며 책을 보 고 정리하며 어느정도 독학으르 공부하긴 했지만, 자주 안하다 보면 금방 잊어

Microsoft Word - Network Programming_NewVersion_01_.docx

Assign an IP Address and Access the Video Stream - Installation Guide

<목 차 > 제 1장 일반사항 4 I.사업의 개요 4 1.사업명 4 2.사업의 목적 4 3.입찰 방식 4 4.입찰 참가 자격 4 5.사업 및 계약 기간 5 6.추진 일정 6 7.사업 범위 및 내용 6 II.사업시행 주요 요건 8 1.사업시행 조건 8 2.계약보증 9 3

CD-RW_Advanced.PDF

Copyright 2012, Oracle and/or its affiliates. All rights reserved.,.,,,,,,,,,,,,.,...,. U.S. GOVERNMENT END USERS. Oracle programs, including any oper

FileMaker 15 ODBC 및 JDBC 설명서

uFOCS


Transcription:

Tmax Getting Started Guide : TMGS-0731-05-380 : Tmax 3.8 : July 31, 2003 : Sep 20, 2003

Tmax Getting Started Guide Tmax 3.8 Tmax Getting Started Guide

Copyright (c) 2001 Tmax Soft Co., Ltd. All Rights Reserved.,,, Tmax Soft.,,,..... Tmax, WebT, WebtoB, JEUS, Host-Link, WebInOneTmax Soft Co., Ltd.. Tel: +82-2-6288-2114, 2006 Fax: +82-2-6288-2115 E-Mail: info@tmax.co.kr Tmax Getting Started Guide Document Edition Date Version TMGS-0501-03-380 July 27, 2002 Tmax 3.8 Tmax Tmax Base, Tmax Standard, Options. Tmax Standard. Tmax Base TP Function (Excluding 2 Phase Commit) Tmax Standard TP Function + 2 Phase Commit Web Admin Console, X.25 Gateway, TCP/IP Gateway, Host-Link, Power Tmax Options Builder Interface Module, SERIAL Gateway, TCP/IP Service Gateway Tmax Getting StartedGuide

Tmax Getting Started Guide

Tmax Getting Started Guide? Tmax Tmax.? 1. : 1.. 2. Tmax 3. 4. Tmax. 5. Tmax. 6. 7. Tmax Tmax Tmax. 8. TP Monitor TP Monitor. 9. WebT WebT Tmax. 2. : Tmax. Tmax Programming Guide Tmax Programming Guide(HostLink) Tmax Programming Guide(RCA) Tmax Programming Guide(RQ) Tmax Programming Guide(UCS) Tmax Programming Guide(WebT) Tmax Reference Manual Tmax FDL Reference Manual Tmax Administration Guide Tmax Error Message Manual Tmax Getting StartedGuide

... 9 1.... 10 1.1. TP Monitor 1.2. Tmax 2.... 12 2.1. Tmax? 2.2. 2.3. 2.4. 3.... 17 4.... 38 5.... 39 5.1. Domain 5.2. Domain 5.3. Tmax Client/Server 6.... 42 7. Tmax... 43 8. TP Monitor... 44 9. WebT... 46 9.1. WebT? 9.2. 9.3. 9.4. 9.5. WebTTmax 9.6.... 52 1. : X/Open DTP Model... 53 1.1. X/Open DTP? 1.2. X/Open DTP Tmax Getting Started Guide

1.3. 1.4. (Interfaces) 1.5. 2. Tmax API Error... 56 2.1. X/Open XATMI 2.2. X/Open TX API 2.4. 3. Tmax... 64 3.1. Tmax 3.2. Client/Server 3.3. 3.4. FDL (Field Definition Language) 4. Tmax API... 72 4.1. Tmax / 4.2. Buffer 4.3. 4.4. 4.5. 4.6. Error Log 4.7. Block Timeout 4.8. 4.9. 4.10. 5.... 95 5.1. Tmax 5.2. Tmax 6. Tmax... 106 7. Tmax system... 108 8. Tmax... 109 8.1. 8.2. Oracle 8.3. Informix 9. WebT... 150 9.1. Applet... 155 Tmax Getting StartedGuide

Tmax Getting Started Guide

Tmax Getting Started Guide Tmax Getting StartedGuide

9 11 16 37 38 42 Tmax 43 TP Monitor 44 WebT 46 Tmax Getting Started Guide

1. 1.1. TP Monitor - - - - - - DBMS Global Transaction - - O/S, Network,DBMS Tmax Getting StartedGuide

1.2. Tmax TP-Monitor - ( ) - ( ) ( ) - - - - Tmax Getting Started Guide

2. 2.1. Tmax? * Transaction Maximization * X/Open, ISO, OSI - X/Open - DTP (AP), (TM), (RM), (CRM) API - ISO - DTP - OSI - TP (ISO0026) * TP-Monitor * * / (C/S) * TP-Monitors ( TP-Monitor) Tmax Getting StartedGuide

2.2. Large-scale OLTP Applications - - On-line - OCS (Order Communication System) - - - ATM (Automatic Teller Machines) - - - - POS (Point-Of-Sale) - - Billing - / OLTP Tmax Getting Started Guide

2.3. * Application * Application * * Throughput Response Time, * Performance Reliability DBMSOverhead * ( ) Tmax Getting StartedGuide

2.4. : Tmax Getting Started Guide

Tmax - File Open & 0.5 M Memory Tmax - File Open & 0.5 M Memory Tmax Getting StartedGuide

3. - Tmax client/server process model (3-tier) - 2 Phase Commit Global transaction - Recovery/Rollback - - Transaction Scheduling - SLM (System Load Management) - DDR (Data Dependent Routing) - DLM (Dynamic Load Management) - Load balancing Service backup - - TCS (Tmax Control Server) - UCS (User Control Server) - POD (Processing On Demand) Reliable Queue (RQ) - - Domain Gateway Service - RCA (Raw Client Agent) - 2-tier 3-tier - Multi Thread - SCA (Simple Client Agent) - 2-tier 3-tier - non-tmax /Tmax - Tmax Getting Started Guide

RDP (Real Data Processor) - UDP - Tmax WinTmax Library - - - Application - Database - - - - - Tmax Getting StartedGuide

3.1. (1) Client/Server (2-tier ) - client/server application - - (, File DB Open/Close ) - (2) Tmax Client/Server (3-tier ) - - idle - Tuning Tmax Getting Started Guide

(3) 2-tier 3-tier 2-tier 3-tier ( 50 ) (50 ) Batch OLTP Application H/WDB (test ),, platform DB (Client/server test),, C/S 3-tier2-tier,,,. Tmax Getting StartedGuide

3.2.,.. X/Open (DTP) application program (AP), transaction manager(tm),resource manager (RM), communication resource manager (CRM) 4. X/Open DTP. RM Application Program(AP) TX TM CRM XA XA+ XATMI TxRPC CPI-C OSI - TP Tmax Getting Started Guide

. Two-phase commit (2PC) protocol Global Transaction ( ) Recovery / Rollback Transaction Scheduling Tmax Getting StartedGuide

3.3. (1) SLM (System Load Management) H/W ) Node 1.2.3 1:5:2 Node 1 1 Node 2, Node3. 3 Node 2. Tmax Getting Started Guide

2) DDR (Data Dependent Routing) (routing) ) Node 1 0-19, 2 20-29, 3. Tmax Getting StartedGuide

(3) DLM (Dynamic Load Management). Node Tmax ) Node1,2 Node1 Tmax. Tmax Getting Started Guide

3.4. Tmax,,,,.. (1) (Machine or Network) Tmax Peer-to-Peer.,. 2. *. ( ) Tmax Getting StartedGuide

*Service Back-up Node Node. (2) ( ),. tms, cas, clh restart. Tmax Getting Started Guide

3.5. Tmax AP process : TCS (Tmax Control Server) Tmax Handler Tmax. UCS (User Control Server) UCS. TCS., UCSTCS. POD (Processing On Demand) POD. Tmax Getting StartedGuide

3.6. Reliable Queue (RQ) TmaxRQ.,. - tpenq(). - queue manager(qmgr). - tpdeq() Queue Manager. Tmax Getting Started Guide

3.7. Domain Gateway Service - (, ) - - - - ( ) - Tmax,.,. Tmax Getting StartedGuide

3.8. RCA (Raw Client Agent) - - - - Thread Thread Pool - - - - RCA RCAH TCP/IP RCAL RCAH Tmax Domain THREAD POOL <RCA Tmax Getting Started Guide

3.9. SCA (Simple Client Agent) - customizing routine - - - - non-tmax /Tmax - - ATTACK TCP/IP CLH Cagent Library WITH- DRAWL MARCH <Cagent Tmax Getting StartedGuide

3.10. RDP (Real Data Processor) - UCS - UDP - CLH(Client Handler). CLH RDP Initial Connection/ Request CLH RDP Real Data Processing Line Tmax Getting Started Guide

3.11. 3.11.1. WinTmax Library - - - 256 - Tmax Domain 3.11.2. tmaxmt Library Tmax Getting StartedGuide

3.12. (Resource Management) Application - - - global monitoring Database - - Tmax 3.13. (Naming Service) - - Tmax Getting Started Guide

3.14. (System Management) Tmax Service, Server, Server Group, Node, Domain. Tmax. - Domain : timeout, timeout, (machine) live check. - Node : message queue timeout value - Server group : load,. - Server : max queue count, queuing Start Count, restart count,,. - Service :, timeout. Monitoring Administration - - - (,, ) Tmax Getting StartedGuide

3.15. (Security) Tmax UNIX 5. 1 : OS,, Permission.( ) 2 : Tmax (Domain) Tmax 3 : Tmax id Tmax 4 :,.(Tmax 4.0 ) 5 : Kerberos. Tmax Getting Started Guide

4. * X/Open, ISO-TP DTP 100% * IPC : Stream I/O(Pipe) Protection, Multiplexing * Integer, Long, Character Synchronous ( ), Asynchronous ( ), Conversational ( ), FDL(Field Definition Language) Structure Array * (Fault Tolerance) Peer-to-Peer H/W S/W * (Scalability) CA(Client Agent) 2-tier 3-tier WebT * (Flexibility) *, API (System Monitoring) * H/W IBM OS 390, UNIX, Linux, Windows NT * PowerBuilder, Delphi, Visual C/C++, Visual Basic,.NET(C#, VB) 4GL Tmax Getting StartedGuide

5. 5.1. Domain TMM (Tmax Manager) CLL (Client Listener) CLH (Client Handler) TMS (Transaction Management Server) RQS (Reliable Queue Server) GW (Gateway Process) Tmadmin (Tmax Administrator) RACD (Remote Access Control Daemon) TCS (Tmax Control Server) UCS (User Control Server) Tmax system. CLL, CLH, TMSAP. Tmax.,.... Tmax system.. Tmax. Tmax. CLH business logic. CLH business logic control. Tmax Getting Started Guide

5.2. Domain Tmax Getting StartedGuide

5.3. Tmax Client/Server MVS(OS390) Server Application IMS or CICS AP Socket Region API T C P / I P V T A M X.25 SNA HOST Link OS (Unix, NT) TCP / IP Tmax Server DB Client Application Tmax Client Unix, Windows, DOS BP(FEP) Application Tmax Cagent Unix, Windows TCP / IP Client Application Unix, Windows, DOS TCP / IP TCP / IP Client Application Unix, Windows, DOS ` TCP / IP Tmax Getting Started Guide

6. O/S Platform Application API XATMI, TX Integrating API XA Network TCP/IP, X.25, SNA(LU 0/6.2) Server All Unix, NT, Linux Client All Unix, Windows, MS-DOS, etc. IBM OS 390, Unix, Linux NT H/W C, C++, COBOL C, C++ 4GL(Power Builder, Delphi, Visual C/C++, Visual Basic,.NET(C#, VB) etc.) DBMS Oracle, Informix, Sybase and DB2 (UDB) Tmax Getting StartedGuide

7. Tmax. (1) Server (SUN ) H / W - Memory: 0.537 Mbytes + 0.2 ~ 0.5 Mbytes / application - Disk -Tmax Server : 6.8 Mbytes(Bin - 2184K, Lib - 4568K, Inc - 83K) S / W - IBM OS 390, UNIX, Linux, NT - C C++, COBOL Compiler Network Protocol - TCP/IP (2) Client (Windows 95 ) H / W - Memory: 0.50 Mbytes - Disk -Tmax Client : 0.277 Mbytes (Include - 83K, DLL - 86K, Type Compiler - 108k), Power Builder 203K(DLL, PBD). S / W - Unix, Linux, NT, Windows (95, 98, 2000), DOS - Power Builder, Delphi, Visual Basic, Visual C++, C,.NET(C#, VB) Network Protocol -TCP/IP Tmax Getting Started Guide

8. TP Monitor TP Monitor - - - - C/S - : - DBMS - - - Naming service - BP clientmultiplexing - - Structure array - HOST Resource -Site - consulting & - Consulting - (O/S, Network, TP-Monitor) Risk C/S monitoring TP-Monitor Report / Tmax Getting StartedGuide

(X/Open DTP, OSI-TP) H/W DBMS Version up (source programs ) Tmax Getting Started Guide

9. WebT 9.1. WebT? * WebTP Monitor * Web Transaction Class Library 9.2. *. * (DB Connection Overhead) * DB Web Network OverHead * Data 9.3. * Internet Mission-Critical * Java-Based Access (Applet, Servlet, JSP) Tmax Getting StartedGuide

9.4. HTTP over TCP/IP Server 1 Server 2 Web Server CGI, PHP, Heavy load AP Connection is established whenever clients issue requests DB server DBM Heavy traffic 2 1. * * * DB Connection OverHead *DB DB Network Traffic Tmax Getting Started Guide

9.5. WebTTmax HTTP over TCP/IP Server 1 Server 2 Web Server Light load AP process DBM Tmax Servlet with WebT Light traffic 2 1. * *DB Connection Overhead *DB Web Network Traffic Tmax Getting StartedGuide

9.6. - Global transaction - DBMS access, process explosion, network traffic. -. Backup System - DB Servlet -Multi-threading, Java API, SSI (Server-Side Include). Tmax Getting Started Guide

Tmax Getting StartedGuide

Tmax Getting Started Guide Tmax Getting Started Guide

: X/Open DTP Model 52 Tmax API Error 55 Tmax 63 Tmax API 71 93 Tmax 104 Tmax system 105 Tmax 106 WebT Sample Program 147 Tmax Getting StartedGuide

1. : X/Open DTP Model 1.1. X/Open DTP? (Distributed Transaction Processing) * X/Open * OSI DTP * OSI DTP (decomposition ) * API 1.2. X/Open DTP Tmax Getting Started Guide

1.3. Application Program (AP) - - Resource Manager (RM) - - - DBMS, ISAM-file access system Transaction Manager(TM) - - id,, commit/rollback - Communication Resource Manager (CRM) - TM TM - Open System Interconnection -Transaction Processing (OSI -TP) - TM 1.4. (Interfaces) TM <-> RM Interface (XA) -TM RM global transaction recovery. ) xa_start(), xa_end(), xa_open(), xa_close() AP -> TM Interface (TX) - global transaction ) tx_begin(), tx_commit(), tx_rollback() AP <->CRM Interface (XATMI, TxRPC, CPI - C) - DTP API XATMI : / ) tpcall(), tpacall(), tpconnect() etc. TxRPC : CPI - C : IBMCPI C peer-to-peer TM <-> CRM Interface (XA+) - TM domain global transaction Tmax Getting StartedGuide

1.5. (Transaction) - - - All or Nothing - Atomicity.. - Consistency.. - Isolation commit. - Durability commit. DTP (Distributed Transaction Processing) - RM(Resource Manager). Global Transactions - RM. commit. Commit -. Rollback -. X/Open TX Interface - tx_begin():. - tx_commit(): commit. - tx_rollback():. Tmax Getting Started Guide

2. Tmax API Error 2.1. X/Open XATMI X/Open DTP XATMI. XAMTI TP Monitor. Tmax Tmax. tpalloc () tprealloc () Buffer tpfree () tptypes () tpcall () tpacall () tpcancel () tpgetrply () tpconnect () tpdiscon () tprecv () tpsend () tpreturn () tpgetrply() tpacall() / Tmax Getting StartedGuide

2.2. X/Open TX API tx_begin () tx_commit () tx_rollback () tx_open () tx_close () tx_set_transaction_timeout () tx_info () tx_set_commit_return () tx_set_transaction_control () commit ( ) (Rolls back ) open ( ) closes ( ) (global transaction) Tmax Getting Started Guide

2.3. Tmax API 2.3.1. Tmax ATMI TP Monitor. Tmax Tmax. tpbroadcast () tpsetunsol () tpgetunsol () tpsetunsol_flag () tpchkunsol () tpstrerror () Userlog () ulogsync () UserLog () gettperrno () gettpurcode () tperrordetail () tpgetpeer_ipaddr Socket () tpgetpeername () tpgetsockname () tpset_timeout () tptobackup () tpstart () tpend () (Log) ulog userlog() + ulogsync() Tmax error number urcode Tmax IP Tmax Tmax RQ tpenq () tpdeq () RQclient request RQ Tmax Getting StartedGuide

tpqstat () tpextsvcname () tmaxreadenv () tpputenv () tpgetenv () WinTmaxStart () WinTmaxEnd () WinTmaxSetCont ext () WinTmaxSend () WinTmaxAcall () WinTmaxAcall2 () tpscmt () tpgetlev () tpchkauth () tpgprio () tpsprio () tpsleep () tp_sleep () tp_usleep () tpschedule () tpuschedule () RQ RQ Tmax Tmax microsecond UCS UCS Tmax Getting Started Guide

2.3.2. FDL API FDLField Definition Language. FDL associative-typed data. Tmax. Tmax Tmax FDL. fbget_fldkey (). fbget_fldname (). fbget_fldno (). fbget_fldtype () (type).( ) fbget_strfldtype (). fbisfbuf (). fbinit (). fbcalcsize (). fballoc (). fbfree (). fbget_fbsize (). fbget_unused (). fbget_used (). fbrealloc (). fbput (). fbinsert () fbchg_tu () fbdelete () fbdelall () fbdelall_tu () fbget () fbgetf () fbget_tu () fbnext_tu () fbgetalloc_tu () fbgetval_last_tu () fbgetlast_tu () fbgetnth () fbfldcount () fbkeyoccur () fbispres ().... (fieldkey[])...... occurrence. entry..... Tmax Getting StartedGuide

fbgetval () fbgetvall_tu () fbupdate () fbgetlen () fbtypecvt () fbputt () fbget_tut () fbgetalloc_tut () fbgetvalt () fbgetvali () fbgetvals () fbgetvals_tu () fbgetntht () fbchg_tut () fbbufop () fbbufop_proj () fbread () I/O fbwrite () fbprint () fbfprint () fbstrerror () Errors getfberrno () fbmake_fldkey () fbftos () fbstof () fbsnull () fbstelinit () fbstinit (). long (type).. occurrence...... integer. String. string...,,,........ FDLFILE. C (stname). C mapping FIELD. C occurrence mapping NULL. mapping C NULL. mappingc NULL. Tmax Getting Started Guide

Tmax Getting StartedGuide 2.4. X/Open DTP Tmax tperrno. tperrno.. Tmax Tmax. tperrno : (ATMI 1.) Error Message (tperrno) Description TPEBADDESC(2) TPEBLOCK(3) TPEINVAL(4) TPELIMIT(5) TPENOENT(6) TPEOS(7) TPEPROTO(9) TPESVCERR(10) Tmax TPESVCFAIL(11) TPESYSTEM(12) Tmax ( ) TPETIME(13) (BLOCKTIME) TPETRAN(14) TPGOTSIG(15) TPEITYPE(17) TPEOTYPE(18) TPEEVENT(22) TPEMATCH(23) RQtpdeq() TPENOREADY(24) TPESECURITY(25) TPEQFULL(26) TPEQPURGE(27) TPECLOSE(28) Tmax TPESVRDOWN(29) TPEPRESVC(30) TPEMAXNO(31) FDL fberrno.

fberrno.. Tmax Tmax FDL. fberror : (FDL 1.) Error Message Description (tperrno) ( ) Tmax Getting Started Guide

3. Tmax 3.1. Tmax ( : Presentation logic) ( DB access logic) - (input). -. - (output) Tmax main() (Application) (Service Routine) - main() (Service registration, resource open, etc.) buffer. - Service routines * :. -.,. ->. ->,. (, ) Tmax Getting StartedGuide

3.2. Client/Server (1) -, blocking. - client/server. Client Server main() { /* Tmax */ tpstart(); /* */ tpalloc(); while(true) { /*..*/ tpcall(servicename,...); servicename(msg) TPSVCINFO *msg; { /* client. */ rcvbuf = msg->data; tpfree(); /*Frees message buffer */ tpend(); /* Tmax */. /* */ tpreturn(); Tmax Getting Started Guide

(2) -. - client/server. Client Server main() { /* Tmax */ tpstart(); /* */ tpalloc(); servicename(msg) TPSVCINFO *msg; while( true){ /*. */ tpacall(servicename,...); /*... */ { /* client. */ rcvbuf = msg->data; /* * / tpgetrply(). tpfree(); /* */ /*client */ tpreturn(); tpend() ; /* Tmax */ Tmax Getting StartedGuide

(3) - / logical connection control,. - control. - connection connection descriptor. -. - Client/Server. Client Server main() { tpstart(); tpalloc(); cd= tpconnect(); /* service */ tpsend(cd,...); /* */ tprecv(cd,...); /* */ tprecv(cd,...);... servicename(msg) TPSVCINFO *msg; { cd = msg->cd ; tprecv(cd,...); tpsend(cd,...); tpreturn(); /* */ tpfree();... tpend(); Tmax Getting Started Guide

(4) - 1 - - -. -. SERVICE A tpforward(b) SERVICE B tpforward(c) SERVICE C tpreturn < (5) - 2 - - - SERVICE B tpsavectx() SERVIE C tpreturn usermain() tprelay(c) UCS Legacy System < Tmax Getting StartedGuide

3.3. -Transaction. -Client. Client Server main() { tpstart(); /* Tmax */ tpalloc(); /* */ while(true){ /*.*/ tx_begin(); /* transaction */ tpcall( servicename,...); if(error) /*Fail: transaction */ tx_rollback(); else /*Succeed : transaction */ tx_commit(); tpfree(); tpend(); /*. */ /* Tmax */ servicename(msg) TPSVCINFO *msg; { /* */ rcvbuf = msg->data;. /* */ tpreturn(); Tmax Getting Started Guide

-. main() { Client Server servicename(msg) TPSVCINFO *msg; tpstart(); /* Tmax */ tpalloc(); /* */ while(true){ /* */ tpcall( servicename,...); tpfree(); tpend();... /* */ /* Tmax */ { rcvbuf = msg -> data; tx_begin(); /* transaction */ If(error) tx_rollback(); /*fail :transaction */ else tx_commit(); /*Succeed : transaction */ /* */ tpreturn(); Tmax Getting StartedGuide

3.4. FDL (Field Definition Language) - Field Key Buffer. - Field Key (NAME, ADDR, TEL ),, (XXX.f). - FDLC XXX.f XXX_fdl.h Mapping. - include XXX_fdl.h. Tmax Getting Started Guide

4. Tmax API 4.1. Tmax / int tpstart(tpstart_t *tpinfo): Tmax. - TPSTART_T char cltname[maxtident+2]; -> ->MAXTIDENT = 16 (must be more than 15) char dompwd[max_passwd_length+2]; -> ->MAX_PASSWD_LENGTH = 16 char usrname[maxtident+2]; -> char usrpwd[max_passwd_length+2]; -> long flags; -> TPUNSOLIGN: TPUNSOLPOLL: TPUNSOL_HND: -. Tmax Getting StartedGuide

int tpend():. main() { if (tpstart ((TPSTART_T *) NULL ) == -1 ) { error routine;, {... if (tpend() == -1 ) { error routine; Tmax Getting Started Guide

4.2. Buffer char *tpalloc(char *type, char *subtype, long size): - - type : * STRING CARRAY X_OCTET STRUCT X_C_TYPE X_COMMON FIELD NULL(\0) (character array) (ex: ) NULL (\0) CARRAY C STRUCT STRUCT confined to char, int, and long. field transmission. - subtype: * : X_C_TYPE, STRUCT X_COMMON NULL. - size : 1) struct account *accp;... accp = (struct account *)tpalloc ( STRUCT, account, sizeof(struct account)); 2) char *str_ptr; char *ptr1, *ptr2; str_ptr = tpalloc ( STRING, NULL, 25); ptr1 = str_ptr; ptr2 = str_ptr + 10; strcpy(ptr1, hello ); strcpy(ptr2, goodbye ); Tmax Getting StartedGuide

char *tprealloc(char *bufptr, long size):. - - bufptr: - size: 1) struct account *accp;... accp = (struct account *) tpalloc( STRUCT, account, sizeof(struct account));... accp = tprealloc (accp, sizeof(struct account) * len); 2) char *octet_ptr; char *ptr1, *ptr2;... octet_ptr = tpalloc( X_OCTET, NULL, 25);... octet_ptr = tprealloc (octet_ptr, 40); void tpfree(char *bufptr): - - - bufptr: 1) struct account *accp; accp = (struct account *) tpalloc( STRUCT, account, sizeof(struct account));... accp = tprealloc(accp, sizeof(struct account) * len); tpfree ((char *)accp); 2) char *str_ptr; char *ptr1, *ptr2; str_ptr = tpalloc( STRING, NULL, 25);... str_ptr = tprealloc(str_ptr, 40); tpfree (str_ptr) ; Tmax Getting Started Guide

long tptypes(char *ptr, char *type, char *subtype) : char *ptr : buffer type char *type : char *subtype : RETURN : 1 ) char type[9], subtype[17]; struct account *accp;... accp = (struct account *)tpalloc( STRUCT, account, sizeof(struct account));... len = tptypes ((char *)accp, type, subtype); Tmax Getting StartedGuide

4.3. int tpcall(char *service, char *sbufp, long slength, char **rbufpp, long *rlength, long flags) : ( ) service : sbufp : slength : (CARRAY, X_OCTET ) rbufpp : rlength : flags : TPNOTRAN : TPNOCHANGE:. TPNOBLOCK :. TPNOTIME : TPSIGRSTRT : signal catch. tpcall();... blocking...... tpreturn() ) transfp = (struct transf *) tpalloc( STRUCT, transf, sizeof(struct transf)); transfp->b_id = q_branchid; transfp->balance = 0.0; strcpy(transfp->errmsg, ); if (tpcall (svc_name, (char *)transfp, 0, (char **)&transf, &nrecv, TPNOFLAGS) == -1) { fprintf(stderr, Tpcall(%s) error->%s!, svc_name, tpstrerror(tperrno)); tpfree((char *)transf); retc = -1; else printf( Branch %ld balance is $.2f\n,transfp->b_id, transfp->balance); Tmax Getting Started Guide

int tpacall(char *service, char *bufptr, long length, long flags) :, ( -1 ) service : bufptr : length : (CARRAY, X_OCTET ) flags :..TPNOTRAN :.TPNOREPLY :.TPNOTIME : (time-out).tpsigrstrt : catch.tpblock :.TPNOBLOCK : ) for (i = 0; i < NSIZE; i++) { audv->b_id = sitelist[i]; if ((cd[i] = tpacall( servicename, (char *)audv, sizeof(struct accnt), TPNOFLAGS)) == -1 ) { fprintf(stderr, %s: %s service request failed for site rep %ld\n, pgmname, sname, sitelist[i]); tpfree ((char *)audv); return (-1); Tmax Getting StartedGuide

int tpgetrply(int *handle, char **bufpp, long *length, long flags) handle : tpacall() bufpp : length : flags :.TPNOTIME, TPSIGRSTRT, TPNOBLOCK.TPGETANY :.TPNOCHANGE :. ) if ((cd1 = tpacall( service1, buf1, 0, TPNOFLAGS)) == -1) error if ((cd2 = tpacall( server2, buf2, 0, TPNOFLAGS)) == -1) error if (tpgetrply(&cd1, &buf1, &buf1len, TPNOFLAGS) == -1) error if (tpgetrply (&cd2, &buf2, &buf2len, TPNOFLAGS) == -1) error. cd = tpacall();...... tpgetrply(cd,..);...... tpreturn() int tpcancel(int handle) : tpacall() - handle : tpacall() * Client ( ). 1. Tmax Getting Started Guide

Tmax Getting StartedGuide

int tpconnect(char *name, char *data, long length, long flags) : ->. -> 1. name : data : (NULL ) length : flags :.TPNOTRAN, TPNOTIME, TPSIGSTRT.TPSENDONLY :.TPRECVONLY : ) if ((cd = tpconnect ( ACCOUNT, NULL, 0, TPSENDONLY)) == -1) { error routine; int tpsend(int cd, char *data, long length, long flags, long *revent) : - cd : tpconnect() - data : - length : - flags.tpnotime, TPSIGSTRT, TPNOBLOCK :.TPRECVONLY :. - revent :. ( ) ) if (tpsend(cd, line, 0, TPRECVONLY, &revent) == -1) { tpend(); exit(1); Tmax Getting Started Guide

cd = tpconnect()... tpsend(cd,... )... tprecv(cd,... )... tprecv(cd,... )... cd = msg->cd... tprecv(cd,... )... tpsend(cd,... )... tpsend(cd,... )... tpreturn() int tprecv(int cd, char **data, long *length, long flags, long *revent) : - -1 ( ) cd : data : length : flags : TPNOCHANGE, TPNOTIME, TPSIGSTRT revent : ( ) ) if (tprecv(cd, &line, &len, TPNOCHANGE, &revent) { tx_rollback(); tpend(); exit(1); Tmax Getting StartedGuide

int tpdiscon(int cd) :. - cd : * * - tpdiscon(). - tpreturn(). ) if ((cd = tpconnect( ACCOUNT, NULL, 0, TPSENDONLY)) == -1) { error... if (error occurs) tpdiscon (cd); /*. */ Tmax Getting Started Guide

4.4. void tpreturn(int rval, int rcode, char *data, long len, long flags) : - rval : TPSUCCESS : TPFAIL : (tperrno ) TPEXIT : TPFAIL rcode : data : len : flags : ) tpreturn (TPSUCCESS, 0, sdata, len, TPNOFLAGS); Tmax Getting StartedGuide

4.5. int tpbroadcast (char *lnid, char *usrname, char *cltname, char *data, long len,long flags) - lnid, usrname, cltname : - data : - len : - flags : TPNOBLOCK, TPNOTIME, TPSIGRSTRT : ) if (tpbroadcast(null, NULL, NULL, (char *)msgdata, sizeof(struct kstrdata), 0) == -1) { printf( tpbroadcast failed tpstrerror = %s\n, tpstrerror(tperrno)); int tpsendtocli(clientid *id, char *data, long len, long flags) :. - id : - data : - len : - flags : TPUDP, TPFLOWCONTROL : refer to Tmax Reference manual ) if (tpsendtocli(cliid, data, (long *)len, TPUDP) == -1){ printf( tpsendtocli failed, tperrno=%d\n, tperrno); return(-1) ; Unsolfunc * tpsetunsol(unsolfunc *func) :. (.) - func : function to perform messages ) if (tpsetunsol(get_post) == -1){ printf( tpsetunsol failed, tpstrerror=%s\n, tpstrerror(tperrno)) ; tpfree((char *)sndbuf); tpend(); exit(1); Tmax Getting Started Guide

int tpgetunsol(int type, char **data, long *len, long flags) :. - type : (UNSOL_TPBROADCAST, NSOL_TPSENDTOCLI) - data : - len : - flag TPBLOCK : tpgetunsol. TPNOBLOCK :. ) if (tpgetunsol(unsol_tpbroadcast, &data, &len, TPGETANY TPBLOCK) == -1){ printf( tpgetunsol failed, tperrno=%d\n, tperrno); tpfree(data); exit(1); tpsetunsol(get_broad); get_broad();...... tpbroadcast() Tmax Getting StartedGuide

4.6. Error Log int userlog(const char *fmt,...) : ULOG. - printf() int UserLog(const char *fmt,...) : ULOG - printf() ) exec sql insert into ktran(no, name) values(:no, :name); if (sqlca.sqlcode!= 0){ userlog( oracle sqlerror=%s,sqlca.sqlerrm.sqlerrmc); tpreturn(tpfail, sqlca.sqlcode, NULL, 0, TPNOFLAGS); char * tpstrerror(int err) :. - err : tperrno ) if (tpcall( ASYNC, (char *)sndbuf, 0, (char **)&rcvbuf, &rcvlen, TPNOFLAGS)== -1){ printf( ASYNC service call failed=%s\n, tpstrerror(tperrno)); tpfree((char *)sndbuf); tpfree((char *)rcvbuf); tpend(); exit(1); Tmax Getting Started Guide

4.7. Block Timeout int tpset_timeout(int timeout) : block timeout. - timeout : ) tpset_timeout (30); 4.8. int tpgetpeer_ipaddr(struct sockaddr *name, int *namelen) : IP. - name : - namelen : name ) if (tpgetpeer_ipaddr((struct sockaddr *)&name, &namelen)== -1){ printf( tpgetpeer_ipaddr is failed\n ); tpreturn(tpfail, 0, NULL, 0, TPNOFLAGS); printf("address of client is %s\n", inet_ntoa(name.sin_addr)); int tpgetpeername(struct sockaddr *name, int *namelen) :. - name : - namelen : ) if (tpgetpeername((struct sockaddr *)&name, &namelen) == -1){ printf( tpgetpeername is failed\n ); tpreturn(tpfail, 0, NULL, 0, TPNOFLAGS); ptr_cli = gethostbyaddr((char *)&(name.sin_addr.s_addr), sizeof(name.sin_addr.s_addr), AF_INET); printf("name of client is %s\n", ptr_cli->h_name); Tmax Getting StartedGuide

int tpgetsockname(struct sockaddr *name, int *namelen) : - name : - namelen : ) if (tpgetsockname(name, &namelen) == -1){ printf( tpgetsockname is failed\n ); tpreturn(tpfail, 0, NULL, 0, TPNOFLAGS); 4.9. int tptobackup() : * * :. TMAX_BACKUP_ADDR : IP TMAX_BACKUP_PORT : ) if (tpcall( SYNC, (char *)sndbuf, 0, (char **)&rcvbuf, &rcvlen, TPNOFLAGS) == -1){ printf( tpcall failed:sync service, tperrno=%d\n, tperrno); tpend(); if (tptobackup() == -1){ printf( tptobackup is failed\n ); tpfree((char *)sndbuf); tpfree((char *)rcvbuf); tpend(); exit(1) Tmax Getting Started Guide

4.10. - - All or Nothing -, int tx_begin() : int tx_commit() : (commit) int tx_rollback() : (rollback) tx_set_transaction_timeout(int timeout) timeout : timeout () ) tx_set_transaction_timeout(30) ; tx_begin( ); if ((cd = tpacall( TOUPPER,(char *)sendbuf, 0, TPNOFLAGS)) == -1) { fprintf(stderr tpacall( TOUPPER,..): %s, tpstrerr(tperrno)); tx_rollback(); tpfree(sendbuf); tpend(); if ((tpcall( TOLOWER,(char *)sendbuf, 0, (char **)&sendbuf, &dlen,tpsigrstrt)) == -1 ) { fprintf(stderr tpcall( TOLOWER,..): %s, tpstrerr(tperrno)); tx_rollback(); tpfree(sendbuf); tpend(); if ((tpgetrply(&cd, (char **)&sendbuf, &clen, TPSIGRSTRT)) == -1) { fprintf(stderr tpgetrply: %s, tpstrerr(tperrno)); tx_rollback(); tpfree(sendbuf); tpend(); tx_commit(); tpfree(sendbuf); tpend(); Tmax Getting StartedGuide

4.11. tmadmin. - - - - boot/down - suspend/resume - int tmadmin(int cmd, void *arg, int opt_flag, long flags): ADMIN(TPSVCINFO *rqst) { char cmd, *buf, *sndbuf; int len; long sndlen; if (rqst->len < 1) tpreturn(tpfail, 0, NULL, 0, 0); cmd = rqst->data[0]; switch (cmd) { case TMADM_TMAX_INFO: len = tmaxinfo(&buf); break; case TMADM_SVC_STAT: len = svcstat(&buf); break; case TMADM_SPR_STAT: len = sprstat(&buf); break; default: len = -1; break; if (len < 0) tpreturn(tpfail, 0, NULL, 0, 0); Tmax Getting Started Guide

if ((sndbuf = (char *)tpalloc("string", NULL, len + 1)) == NULL) tpreturn(tpfail, 0, NULL, 0, 0); memcpy(sndbuf, buf, len); sndlen = len; /* do not free it's static area free(buf); */ tpreturn(tpsuccess, 0, sndbuf, sndlen, 0); int tmaxinfo(char **buf) { int i, n, tmp, size, num_node; int major, minor, patch; int year, month, day; struct tmadm_tmax_info *info; size = sizeof(struct tmadm_tmax_info) + (MAX_NODE - 1) * sizeof (struct tmadm_node_summary); info = (struct tmadm_tmax_info *) malloc(size); if (info == NULL) return -1; memset(info, 0x00, size); info->header.version = _TMADMIN_VERSION; info->header.size = size; n = tmadmin(tmadm_tmax_info, info, 0, 0); if (n < 0) return -1; 4.12... WinTmaxtmaxmt.. WinTmax. WinTmaxStart(TPSTART_T *tpinfo) :Tmax tpstart(). Tmax Getting StartedGuide

WinTmaxEnd(() :Tmax tpend(). WinTmaxSetContext(void *winhandle, unsigned int msgtype, int slot) :. WinTmaxSend(int recvcontext, char *svc, char *data, long len, long flags) : Tmax recvcontext WinTmaxSetContext(). SendMessage. tmaxmt. WinTmaxAcall(TPSTART_T *sinfo, HANDLE whandle, unsigned int msgtype, char *svc, char *sndbuf, int len, int flags); :Tmax / / Tmax recvcontext WinTmaxSetContext(). SendMessage. WinTmaxAcall2(TPSTART_T *sinfo, WinTmaxCallback fn, char *svc, char *sndbuf, int len, int flags); :Tmax / / WinTmaxAcall. WinTmax.. tmaxmt. tmaxmt Tmax /. Tmax Getting Started Guide

4.13. int tpsleep(int timeout) :. - timeout : () ) if (tpsleep(10) > 0){ if (tpgetrply( &cd, &rc_buf, &len, TPNOBLOCK) == -1) { printf( tpgetrply failed tperrno=%d, cd=%d \n, tperrno, cd); tpfree(sn_buf); tpfree(rc_buf); tpend(); exit(-1); Tmax Getting StartedGuide

5. 5.1. Tmax - UNIX Tmax.profile,.login,.cshrc TMAX_HOST_ADDR = Tmax (=IP Address) TMAX_HOST_PORT = (default : 8888). SDLFILE = sdlc * * :, TMAX_BACKUP_ADDR,TMAX_BACKUP_PORT tpstart() : -, - Tmax client library (libcli.a / libcli.so) - (STRUCT ) STRUCT, X_C_TYPE, X_COMMON. dummy struct. sdlc. ) sdlc -c -i mystruct.s -> mystruct.sdl, mystruct_sdl.h Tmax Getting Started Guide

-. Tmax Getting StartedGuide

- Client Makefile : Makefile : ) Makefile (solaris) -, : UNIX TMAXDIR, TMAX_HOST_ADDR, FDLFILE, TMAX_HOST_PORT, SDLFILE CFLAGS-xarch = V9 Tmax Getting Started Guide

. - UNIX Tmax system.profile(bourne shell),.login(c shell),.cshrc(c shell),.bashrc(linux) TMAXDIR = Tmax - Tmax Tmax DOMAIN : NODE : SVRGROUP : SERVER : SERVICE :. cfl. cfl [ -i system configuration file] ) cfl -i tmconfig.m, default tmconfig.gst :.tmboot :. - Tmax main() - (STRUCT ) STRUCT. sdlc _sdl.c. ) sdlc c -i mystruct.s -> mystruct_sdl.c mystruct_sdl.h _sdl.c. -Tmax server library (libsvr.a libsvr.so) Tmax Getting StartedGuide

- : Tmax Getting Started Guide

Tmax Getting StartedGuide - Makefile : Makefile. ) Makefile(Solaris)

-, Tmax UNIX TMAXDIR Tmax Tmax Tmax (tmm, tms, cll, clh, racd) tmboot tmboot [-f Tmax ] : Tmax tmboot -s : tmdown tmdown [ -f Tmax ] : Tmax tmdown -s : Tmax Getting Started Guide

5.2. Tmax : Tmax. -. - 8. DOMAIN NODE SVRGROUP SERVER SERVICE GATEWAY ROUTING RQ Tmax DOMAIN DOMAIN <resrc_name> * NODE <uname> * SVRGROUP <svg_name> - (*) (: *DOMAIN, *NODE ) -. (,) - cfl ) cfl -i - Tmax (< > ) SHMKEY = <UNIQUE IPCKEY>, MAXUSER = 256, TPORTNO=8999 TMAXDIR = <TMAX installed directory>, APPDIR = <APPLICATION directory>, PATHDIR = <PATH directory > NODENAME = <uname>, DBNAME=ORACLE, OPENINFO = ORACLE_XA+Acc =P/tmaxsoft/tmaxsoft+SesTm=60 * SERVER <svr_name> SVGNAME = < svg_name >, MIN = 5, MAX = 10 * SERVIC <svc_name> SVRNAME = < svr_name > Tmax Getting StartedGuide

(1) Domain (DOMAIN ) : <resrc_name> - Tmax (domain) 16. SHMKEY -. - : 32,768-262,143 -. MAXUSER - Domain TPORTNO -. (2) Node (NODE ) :. <uname> - 16. - uname -n. * * : hostnameuname -n. TMAXDIR, APPDIR, PATHDIR - TMAXDIR : Tmax - APPDIR : - PATHDIR : Tmax (3) Server group (SVRGROUP ) : 1. <svg_name> -. - SVRGROUP. - 16 NODENAME -. Tmax Getting Started Guide

: 4 DBNAME - OPENINFO -. - 256 - Oracle OPENINFO = ORACLE_XA+Acc = P/ / + SesTm = 60 Informix OPENINFO = CLOSEINFO - - 256 Informix CLOSEINFO = TMSNAME - TMS - 16 (4) Server (SERVER ) <svr_name> - - 16 SVGNAME - - SVRGROUP. CLOPT - (dommand line option) - --,. - main() tpsvrinit(). - -o : -o output. -e : -e error. ) CLOPT = -e err1 -- abc MIN, MAX - MIN : - MAX : Tmax Getting StartedGuide

CONV - Y. ( N.) (5) Service (SERVICE ) <svc_name> - 16. - SERVICE. - SERVICE. SVRNAME -. (6) (GATEWAY, ROUTING, RQ) : Tmax Administration Guide. Tmax Getting Started Guide

6. Tmax <tmboot : Tmax > Option -A SERVER -b -c Client Handler (CLH) (Tmax 4.0 ) -f -g -h Online Help -k -s, -t flag -n -o clopt_string CLOPT string -q RQ svg_name RQS -s [-k ] -k (-k ) -S -t TMS TMS. -T Tmax -w, RQ,Gateway -V <tmdown : Tmax > Option -A -f -g -h Online Help -i tmdown -k -s, -t flag -n -p id -q RQ svg_name RQS -s [-k ] st p spr_no (-k, ) -S -t TMS tms (RM) -w Wait_sec Wait_sec -V Tmax Getting StartedGuide

Tmax Getting Started Guide

Tmax system : Tmax (monitor) Tmax Tmax :tmadmin. : tmadmin tool - Config(cfg) : -stat(st) : <config : (cfg)> Option -d -n [ ]. -g [ ]. -v [ ] -s [ ]. <stat : (st) > Option -p [ ]. -s [ ]. ti (Tmax Information) Tmax. (version), (maxuser),. ci (Client Information). (status), IP Address, (count) -s si (Server Information).,, (status), (count), (qcount), (qpcount), (maxqcount) (emaxcount) Tmax Getting StartedGuide

8. Tmax 8.1. (1) ( ) - Unix machine - (TOUPPER() STRING ) - Client program : client.c - Server program : touppersvc.c - Makefile (Tmax Makefile ) - tmconfig.m : Tmax -Client Tmax : NULL ( ) : STRING : tpcall() : N/A - Server : TOUPPER 1 Database : Tmax Getting Started Guide

(client.c) #include <stdio.h> #include <string.h> #include <usrinc/atmi.h> main(int argc, char *argv[]) { char *sendbuf; long rlen; if (argc!= 2) { fprintf(stderr, Usage: $ %s string\n, argv[0]); exit(1); if (tpstart((tpstart_t *)NULL) == -1) { fprintf(stderr, tpstart failed\n ); exit(1); if ((sendbuf = tpalloc( STRING, NULL, 128)) == NULL) { fprintf(stderr, Error allocation send buffer\n ); tpend(); exit(1); strcpy(sendbuf,argv[1]); if (tpcall( TOUPPER, sendbuf, 0, &sendbuf, &rlen, TPNOFLAGS) == -1) { fprintf(stderr, Can t send request to service TOUPPER->%s!\n, tpstrerror(tperrno)); tpfree(sendbuf); tpend(); exit(1); printf( Return value:%s\n, sendbuf); tpfree(sendbuf); tpend(); Tmax Getting StartedGuide

( touppersvc.c ) #include <stdio.h> #include <usrinc/atmi.h> TOUPPER(TPSVCINFO *msg) { int i; for (i = 0; i < msg->len; i++) msg->data[i] = toupper(msg->data[i]); msg->data[i] = \0 ; tpreturn(tpsuccess, 0, msg->data, 0, TPNOFLAGS); *DOMAIN dom1 *NODE tmax1 SHMKEY=77900, MAXUSER=100, MINCLH=1, TPORTNO=8888, BLOCKTIME=60, TXTIME=60 TMAXDIR = /home/tmax, APPDIR = /home/tmax/appbin, PATHDIR = /home/tmax/path, TLOGDIR = /home/tmax/log/tlog, ULOGDIR = /home/tmax/log/slog, SLOGDIR = /home/tmax/log/ulog *SVRGROUP svg1 *SERVER touppersvc *SERVICE TOUPPER NODENAME=tmax1 SVGNAME=svg1, MIN=1, MAX=5, CLOPT = e $(SVR).err o $(SVR).out SVRNAME=touppersvc Tmax Getting Started Guide

(2) ( / ) - string. (TOUPPER(), TOLOWER().) - (native client). - Client program : client.c - Server program : tosvc.c - Makefile (Tmax Makefile.) - tmconfig.m : Tmax - strdata.s : SDLFILE - Client Tmax : default : STRUCT (C ) : tpcall(), tpacall() - Server : (TOUPPER, TOLOWER). Database :. (strdata.s) struct strdata { int len; char sdata[20]; ; Tmax Getting StartedGuide

( client.c ) #include <stdio.h> #include <string.h> #include <usrinc/atmi.h> #include strdata.s main(int argc, char *argv[]) { struct strdata *sendbuf, *sendbuf1; long dlen, clen; int cd; if(argc!= 3) { fprintf(stderr, Usage: $ %s string STRING\n, argv[0]); exit(1); if (tpstart((tpstart_t *)NULL) == -1) { fprintf(stderr, tpstart failed\n ); exit(1); sendbuf = (struct strdata *) tpalloc( STRUCT, strdata, 0); if (sendbuf == NULL) { fprintf(stderr, Error allocatio send buffer\n ); tpend(); exit(1); sendbuf1 = (struct strdata *)tpalloc( STRUCT, strdata, 0); if (sendbuf1 == NULL) { fprintf(stderr, Error allocatio send buffer\n ); tpfree((char *)sendbuf); tpend(); exit(1); strcpy(sendbuf->sdata, argv[1]); strcpy(sendbuf1->sdata, argv[2]); if ((cd = tpacall( TOUPPER, (char *)sendbuf, 0, TPNOFLAGS)) == -1) { fprintf(stderr, Toupper error -> %s, tpstrerror(tperrno)); tpfree ((char *) sendbuf); tpfree((char *) sendbuf1); tpend(); Tmax Getting Started Guide

exit(1); if (tpcall( TOLOWER, (char *)sendbuf1, 0, (char**)&sendbuf1, &dlen, TPSIGRSTRT) == -1) { fprintf(stderr, Tolower error -> %s, tpstrerror(tperrno)); tpfree((char *) sendbuf); tpfree((char *) sendbuf1); tpend(); exit(1); if (tpgetrply(&cd, (char **)&sendbuf, &clen, TPSIGRSTRT) == -1) { fprintf(stderr, Touuer getrply error -> %s, tpstrerror(tperrno)); tpfree((char *) sendbuf); tpfree((char *) sendbuf1); tpend(); exit(1); printf( return value %s %s\n, sendbuf->sdata, sendbuf1->sdata); tpfree((char *) sendbuf); tpfree((char *) sendbuf1); tpend(); exit(0); ( tosvc.c ) #include <stdio.h> #include <usrinc/atmi.h> #include strdata.s TOUPPER(TPSVCINFO *msg) { int i = 0; struct strdata *stdata; stdata = (struct strdata *)msg->data; while(stdata->sdata[i]!= \0 ) { stdata->sdata[i] = toupper(stdata->sdata[i]); i++; ; tpreturn(tpsuccess, 0, (char *)stdata, 0, TPNOFLAGS); Tmax Getting StartedGuide

TOLOWER(TPSVCINFO *msg) { int i = 0; struct strdata *stdata; stdata = (struct strdata *)msg->data; while(stdata->sdata[i]!= \0 ) { stdata->sdata[i] = tolower(stdata->sdata[i]); i++ ; ; tpreturn(tpsuccess, 0, (char *)stdata, 0, TPNOFLAGS); *DOMAIN dom1 *NODE tmax1 *SVRGROUP svg1 *SERVER tosvc *SERVICE TOUPPER TOLOWER SHMKEY=77900, MAXUSER=100, MINCLH=1, TPORTNO=8888, BLOCKTIME=60, TXTIME=60 TMAXDIR= /home/tmax, APPDIR= /home/tmax/app, PATHDIR= /home/tmax/path NODENAME=tmax1 SVGNAME=svg1, MIN=1, MAX=5 SVRNAME=tosvc SVRNAME=tosvc Tmax Getting Started Guide

(3) ( ) -,. - ORACLE programing 7.2 r - Client program: client.c - Server program: multi_sel.pc - Makefile (Tmax Makefile.) - tmconfig.m : Tmax - sel_o.s : SDLFILE - Client Tmax : default : STRING type, STRUCT type. : - Server tmconfig.m. Database : Oracle DB (sel_o.s) struct sel_o { char seqno[10]; char corpno[10]; char compdate[8]; Int totmon; Float guarat; Float guamon; ; Tmax Getting StartedGuide

(client.c) #include <stdio.h> #include <usrinc/atmi.h> #include sel_o.s main(int argc, char *argv[]) { struct sel_o *rcvbuf; char *sndbuf; long sndlen, rcvlen, revent; int cd; if (argc!= 2) { printf( Usage: client string\n ); exit(1); if (tpstart ((TPSTART_T *) NULL) == -1) { printf( tpstart failed\n ); exit(1); if ((sndbuf = tpalloc ( STRING, NULL, 12)) == NULL) { printf( tpalloc failed:sndbuf\n ); tpend ( ) ; exit(1); if((rcvbuf = (struct sel_o *) tpalloc( STRUCT, sel_o, 0)) == NULL) { printf( tpalloc failed:sndbuf\n ); tpfree(sndbuf); tpend(); exit(1); strcpy(sndbuf, argv[1]); if ((cd = tpconnect ( MULTI, sndbuf, 0, TPRECVONLY)) == -1){ printf( tpconnect failed:conver service, tperrno=%d\n, tperrno); tpfree(sndbuf); tpfree ((char *)rcvbuf); tpend(); exit(1); /*. */ Tmax Getting Started Guide

while(1){ /* */ if (tprecv(cd, (char **)&rcvbuf, &rcvlen, TPNOTIME, &revent) == -1){ printf( tprecv failed, tperrno=%d, revent=%x\n, tperrno, revent); tpfree ( sndbuf ) ; tpfree ((char *)rcvbuf); tpend(); exit(1); /* tpreturn() */ if (revent == TPEV_SVCSUCC){ printf( all is completed\n ); break; printf( seqno = %s\t\t corpno =%s\n, rcvbuf->seqno, rcvbuf->corpno); printf( compdate = %s\t\t totmon =%d\n, rcvbuf->compdate, rcvbuf->totmon); printf( guarat = %f\t\t guamon =%f\n\n\n, rcvbuf->guarat, rcvbuf->guamon); tpfree(sndbuf); tpfree((char *)rcvbuf); tpend(); (multi_sel.pc) #include <stdio.h> #include <string.h> #include <usrinc/atmi.h> #include sel_o.s /* Oracle. */ exec sql begin declare section; char seq[10]; int seqi; struct sel_o *sndbuf; exec sql end declare section; exec sql include sqlca; MULTI(TPSVCINFO *msg) { int i, cd; long sndlen, revent; memset(seq, 0, 10); strcpy(seq, msg->data); Tmax Getting StartedGuide

seqi = atoi(seq); if ((sndbuf = (struct sel_o *) tpalloc ( STRUCT, sel_o, 0)) == NULL) { printf( tpalloc failed:\n ); tpreturn(tpfail, -1, NULL, 0, TPNOFLAGS); /*. */ exec sql declare democursor cursor for select * from corp where seqno > :seqi; exec sql open democursor; exec sql whenever not found goto end_of_fetch; if (sqlca.sqlcode!= 0){ printf( oracle sqlerror=%s, sqlca.sqlerrm.sqlerrmc); tpreturn(tpfail, sqlca.sqlcode, NULL, 0, TPNOFLAGS); /* Oracle. */ while (sqlca.sqlcode == 0 ){ exec sql fetch democursor into :sndbuf; if (tpsend(msg->cd, (char *)sndbuf, 0, TPNOTIME, &revent) == -1){ printf( tpsend failed, tperrno=%d, revent=%x\n, tperrno, revent); tpfree ((char *)sndbuf); tpreturn(tpfail, -1, NULL, 0, TPNOFLAGS); tpreturn(tpfail, sqlca.sqlcode, NULL, 0, 0); end_of_fetch: exec sql close democursor; tpreturn(tpsuccess, 0, NULL, 0, TPNOFLAGS); mktable.sql Oracle table creation script sqlplus scott/tiger <<! create table multi_sel ( seqno VARCHAR(10), corpno VARCHAR(10), compdate VARCHAR(8), totmon NUMERIC(38), guarat FLOAT, guamon FLOAT ) ; Tmax Getting Started Guide

create unique index idx_tdb multi_sel(seqno);! sel.sql Oracle sqlplus scott/tiger <<! Desc multi_sel; select * from multi_sel;! *DOMAIN dom1 *NODE tmax1 *SVRGROUP svg1 *SERVER multi_sel *SERVICE MULTI SHMKEY=77900, MAXUSER=100, MINCLH=1, TPORTNO=8880, BLOCKTIME=60, TXTIME=60 TMAXDIR= /home/tmax, APPDIR= /home/tmax/app, PATHDIR= /home/tmax/path NODENAME=tmax1, DBNAME=ORACLE, OPENINFO="ORACLE_XA+Acc=P/scott/tiger+SesTm=60, TMSNAME=svg1_tms SVGNAME=svg1, CONV=Y SVRNAME=multi_sel - DBNAME. OPENINFO Oracle. TMSNAME. CONV = Y. Tmax Getting StartedGuide

8.2. Oracle * Oracle Unix (.profile.login.cshrc ) - ORACLE_HOME /user/oracle ORACLE_SID ORA805 ORACLE_TERM vt100 ORA_NLS32 $ORACLE_HOME/ocommon/nls/admin/data TNS_ADMIN $ORACLE_HOME/network/admin NLS_LANG American_America.US7ASCII path ($path $ORACLE_HOME/bin $TMAXDIR/bin) LD_LIBRARY_PATH ${LD_LIBRARY_PATH:/user/oracle/lib Makefile -. # Server Pro*C makefile include $(ORACLE_HOME)/precomp/lib/env_precomp.mk ORALIBDIR = $(LIBHOME) ORALIB = $(PROLDLIBS) -lclntsh TARGET = <svrname> APOBJS = $(TARGET).o SDLFILE = <sdlfilename> LIBS = -lsvr -lsocket -lnsl -loras OBJS = $(APOBJS) $(SDLOBJ) $(SVCTOBJ) SDLOBJ = ${SDLFILE:.s=_sdl.o SDLC = ${SDLFILE:.s=_sdl.c SVCTOBJ = $(TARGET)_svctab.o CFLAGS = -O -I$(TMAXDIR) APPDIR = $(TMAXDIR)/appbin SVCTDIR = $(TMAXDIR)/svct TMAXLIBDIR = $(TMAXDIR)/lib #.SUFFIXES :.c.c.o: $(CC) $(CFLAGS) -c $< Tmax Getting Started Guide

# # server compile # all: $(TARGET) $(TARGET): $(OBJS) $(CC) $(CFLAGS) -L$(TMAXLIBDIR) -o $(TARGET) -L$(ORALIBDIR) $(ORALIB) $(OBJS) $(LIBS) $(NSDLOBJ) mv $(TARGET) $(APPDIR) rm -f $(OBJS) $(APOBJS): $(TARGET).pc proc iname=$(target) include=$(tmaxdir) $(CC) $(CFLAGS) -c $(TARGET).c $(SVCTOBJ): touch $(SVCTDIR)/$(TARGET)_svctab.c $(CC) $(CFLAGS) -c $(SVCTDIR)/$(TARGET)_svctab.c $(SDLOBJ): $(TMAXDIR)/bin/sdlc -i../sdl/$(sdlfile) $(CC) $(CFLAGS) -c../sdl/$(sdlc) # clean: -rm -f *.o core $(TARGET) $(TARGET).lis TMS Makefile Tmax Getting StartedGuide

(1) Insert -.. - Client program : client.c - Server program : tdbsvr.pc - Makefile (Tmax Makefile.) - tmconfig.m: Tmax - mktables.sql : SQL script - sel.sql : SQL script - demo.s : SDLFILE - Tmax : NULL : STRUCT ( sdlc ). : tpcall(). :. - : Oracle insert 1 : STRUCT ( ) DB : Oracle database Tmax SVRGROUP. Tmax Getting Started Guide

( demo.s ) struct ktran{ int no; ichar name[20]; ; ( client.c ) #include <stdio.h> #include <usrinc/atmi.h> #include demo.s main(int argc, char *argv[]) { struct ktran *sndbuf, *rcvbuf; long sndlen, rcvlen; int cd; if(argc!= 3) { printf( Usage: client no name\n ); exit(1); printf( tpstart-start \n ); if (tpstart((tpstart_t *) NULL) == -1) { printf( Tpinit failed\n ); exit(1); printf( tpstart-ok \n ); if ((sndbuf = (struct ktran *) tpalloc ( STRUCT, ktran, 0)) == NULL) { printf( tpalloc failed:sndbuf, tperrno=%d\n, tperrno); tpend(); exit(1); if((rcvbuf = (struct ktran *) tpalloc ( STRUCT, ktran, 0)) == NULL) { printf( tpalloc failed:rcvbuf, tperrno=%d\n, tperrno); tpfree((char *)sndbuf); tpend(); exit(1); sndbuf->no = atoi(argv[1]); strcpy(sndbuf->name, argv[2]); printf( tpcall-start \n ); if (tpcall ( INSERT, (char *)sndbuf, 0, (char **)&rcvbuf, &rcvlen, Tmax Getting StartedGuide

TPNOFLAGS) == -1){ printf( tpcall failed:ora service, tperrno=%d, tperrno); printf( tpurcode=%d\n, tpurcode); tpfree ((char *)sndbuf); tpfree ((char *)rcvbuf); tpend( ) ; exit(1); tpfree ((char *)sndbuf); tpfree ((char *)rcvbuf); tpend ( ) ; ( tdbsvr.pc ) #include <stdio.h> #include <usrinc/atmi.h> #include demo.s exec sql begin declare section; char name[20]; int no; exec sql end declare section; exec sql include sqlca; INSERT(TPSVCINFO *msg) { struct ktran *stdata; stdata = (struct ktran *)msg->data; strcpy(name, stdata->name); no = stdata->no; printf( Ora service started\n ); /* databaseinsert. */ exec sql insert into testdbl(no, name) values(:no, :name); if(sqlca.sqlcode!= 0){ printf( oracle sqlerror=%s, sqlca.sqlerrm.sqlerrmc); tpreturn(tpfail, sqlca.sqlcode, NULL, 0, TPNOFLAGS); Tmax Getting Started Guide

tpreturn(tpsuccess, sqlca.sqlcode, (char *)stdata, 0, TPNOFLAGS); mktable.sql sqlplus tmax/tmax <<! create table testdb1 ( no number(7), name char(30) ); sel.sql sqlpus tmax/tmax <<! desc testdb1; select * from testdb1; select count (*) from testdb1; Tmax Getting StartedGuide

*DOMAIN dom1 *NODE tmax1 *SVRGROUP svg1 *SERVER tdbsvr *SERVICE INSERT SHMKEY=77900, MAXUSER=100, MINCLH=1, TPORTNO=8888, BLOCKTIME=60, TXTIME=60 TMAXDIR= /home/tmax, APPDIR= /home/tmax/app, PATHDIR= /home/tmax/path NODENAME=tmax1, DBNAME=ORACLE, OPENINFO= Oracle_XA+Acc=P/scott/tiger+SesTm=60, TMSNAME=svg1_tms SVGNAME=svg1, MIN=1, MAX=5 SVRNAME=tdbsvr - DBNAME. OPENINFO Oracle database. tpsvrinfo(). Oracle database, CLOSEINFO. TMSNAME OPENINFO svg1 Tmax Getting Started Guide

(2) Select - Oracle select. - client.c : client - cdate.c : client.c - sel_his.pc : Oracle source - Makefile (Tmax Makefile.) - tmconfig.m : Tmax - mktables.sql : table SQL - sel.sql : table SQL - his.s : SDLFILE - Client Tmax : NULL. : STRUCT : stru_his. : tpcall(). :. - Server : SEL_HIS, Oracle DBselect Database : Oracle database Tmax SVRGROUP. : main( ). ( his.s ) struct stru_his { long ACCOUNT_ID; long TELLER_ID; long BRANCH_ID; long AMOUNT; ; Tmax Getting StartedGuide

(sel_his.pc) #include <stdio.h> #include <usrinc/atmi.h> #include his.s #define NARRAY 5 #define TOOMANY -2112 #define NOTFOUND 1403 EXEC SQL include sqlca.h; EXEC SQL begin declare section; long key, rowno; long account_id[narray],teller_id[narray], branch_id[narray], amount [NARRAY]; EXEC SQL end declare section; /* global.*/ SEL_HIS(TPSVCINFO *msg) /* */ { struct stru_his *transf; int i, lastno; int return_code; /*msg. */ transf = (struct stru_his *) msg->data; key = transf->account_id; if ((transf = (struct stru_his *) tprealloc((char*)transf, sizeof(struct stru_his) * NARRAY )) == (struct stru_his *)NULL) { fprintf(stderr, tprealloc error ->%s\n, tpstrerror(tperrno)); tpreturn(tpfail, tperrno, NULL, 0, TPNOFLAGS); /* transf. */ /* account_ids global. */ EXEC SQL select account_id, teller_id, branch_id, amount into :account_id, :teller_id, :branch_id, :amount from sel_his where account_id> :key order by account_id; if (sqlca.sqlcode!= 0 && sqlca.sqlcode!= NOTFOUND && sqlca.sqlcode!= TOOMANY) { fprintf(stderr, SQL ERROR ->NO(%d):%s\n, sqlca.sqlcode, sqlca.sqlerrm.sqlerrmc); tpreturn(tpfail, sqlca.sqlcode, NULL, 0, TPNOFLAGS); /* sql error (select.) */ Tmax Getting Started Guide

/* lastno. */ lastno = sqlca.sqlerrd[2]; rowno = lastno; if(lastno!=0) return_code = lastno; else return_code = NOTFOUND; /* selectdata. */ if(sqlca.sqlcode == TOOMANY) lastno = NARRAY; /* Oracle select. */ for (i = 0 ; i < rowno; i++) { transf[i].account_id = account_id[i]; transf[i].teller_id = teller_id[i]; transf[i].branch_id = branch_id[i]; transf[i].amount = amount[i]; tpreturn(tpsuccess, return_code,(char *)transf, sizeof(struct stru_his) * i, TPNOFLAGS); ( client.c ) #include <stdio.h> #include <usrinc/atmi.h> #include his.s #define NARRAY 5 #define NOTFOUND 1403 main(int argc,char *argv[]) { struct stru_his *transf; float tps; int i, j, loop, cnt_data = 0, sec1, sec2; long urcode, nrecv, narray; long account_id, teller_id, branch_id, amount, key; char ts[30], te[30]; if (argc!= 2) { printf( Usage:$%sLOOP (NARRAY = 10)!\n, argv[0]); exit(0); Tmax Getting StartedGuide

loop = atoi(argv[1] ); if (tpstart ((TPSTART_T *) NULL) == -1) { /* Tmax. */ fprintf(stderr, tpstart(tpinfo) failed -> %s!\n, tpstrerror(tperrno)); exit(1); htime(ts,&sec1); key = 0; /*. */ for (i = 0; i <loop ; i++) { if ((transf = (struct stru_his *) tpalloc( STRUCT, stru_his, 0)) == (struct stru_his *)NULL) { fprintf(stderr, tpalloc(struct..)failed->%s!\n, tpstrerror(tperrno)); tpend(); exit(1); /* Creates c structure type buffer. */ transf->account_id = key; tx_set_transaction_timeout(30); /*. */ if (tx_begin()< 0) { /* global transaction. */ fprintf(stderr, tx_begin () failed ->%s!\n, tpstrerror(tperrno)); tpfree ((char *)transf); tpend (); exit(0); /* SEL_HIS */ if (tpcall( SEL_HIS,(char *)transf, 0,(char **)&transf, &nrecv, TPNOFLAGS) == -1){ fprintf(stderr, Tpcall(SELECT...)error->%s!, tpstrerror (tperrno)); tpfree((char *)transf); tx_rollback(); /*, rollback. */ tpend(); exit(); urcode = tpurcode; /*,commit.*/ if (tx_commit() == -1) { fprintf(stderr, tx_commit() failed ->%s!\n, tpstrerror(tperrno)); tpfree((char *)transf); tpend(); exit(0); if (urcode!=notfound){ Tmax Getting Started Guide

narray = urcode; key = transf[narray-1].account_id; for (j =0; j < NARRAY; j++) { if (j == 0) printf( %-12s%-10s%-10s%-10s\n, ACCOUNT_ID, TELLER_ID, BRANCH_ID, AMOUNT ); account_id=transf[j].account_id; teller_id=transf[j].teller_id; branch_id=(*(transf+j)).branch_id; amount=transf[j].amount; printf( %-12d %-10d %-10d %-10d\n, account_id, teller_id, branch_id, amount); /* Oracle select. */ cnt_data += j; else if (urcode == NOTFOUND){ /* select, EOF, */ printf( No records selected!\n ); break; tpfree ((char *)transf); tpfree ( (char *)transf); tpend(); htime(te, &sec2); printf( TOT.COUNT = %d\n, cnt_data); printf( Start time = %s\n, ts); printf( End time = %s\n, te); if ((sec2 - sec1)! = 0) tps =(float) cnt_data / (sec2-sec1); else tps = cnt_data; printf( Interval = %d secs ==> %10.2fT/S\n, sec2 - sec1, tps); Tmax Getting StartedGuide

( cdate.c) #include <stdio.h> #include <time.h> htime(char *cdate,int *sec) { long time(),timef,pt; char ct[20], *ap; struct tm *localtime(),*tmp; pt = time(&timef); *sec = pt; tmp = localtime(&timef); ap = asctime(tmp); sscanf(ap, %*s%*s%*s%s,ct);/* HH.MM.SS YY.MM.DD */ sprintf(cdate, %02d. %02d. %02d %s,tmp->tm_year, ++tmp->tm_mon, tmp- >tm_mday,ct); mktable.sql sel.sql sqlplus tmax/tmax <<! create table sel_his( account_id LONG, teller_id LONG, branch_id LONG, amount LONG ) ; create unique index idx_tdb1 on sel_his(account_id); sqlplus tmax/tmax<<! desc sel_his; select * from sel_his; *DOMAIN dom1 *NODE tmax1 SHMKEY=77900, MAXUSER=100, MINCLH=1, TPORTNO=8880, BLOCKTIME=60, TXTIME=60 TMAXDIR= /home/tmax, APPDIR= /home/tmax/app, PATHDIR= /home/tmax/path Tmax Getting Started Guide