OpenTP1 Version 7 User's Guide
This subsection explains the settings required to link with HiRDB.
You must register HiRDB in the OpenTP1 system. Use the trnlnkrm command to do this.
The following shows an example of the trnlnkrm command for HiRDB Version 8:
trnlnkrm -a HiRDB_DB_SERVER -s pdtxa_switch -o pdcltx32.lib |
For details about the trnlnkrm command, see Chapter 7. Operation Commands. For details about the information to be specified in the trnlnkrm command, such as RM name, RM switch name, and RM-related object name, see the manual Scalable Database Server HiRDB Version 7 Installation and Design Guide, for Windows systems.
The following notes explain execution of the trnlnkrm command.
prcsvpath c:\hirdb_s\client\utl |
You must set appropriate values in HiRDB environment variables in order to access HiRDB. Specify the environment variables in putenv format in the following OpenTP1 system definitions:
The following shows an example of a transaction service definition:
putenv PDHOST host1 putenv PDNAMEPORT 22200 putenv PDTMID smpl putenv PDSWAITTIME 6000 |
The following shows an example of a user service definition or user service default definition:
putenv PDHOST host1 putenv PDNAMEPORT 22200 putenv PDTMID smpl putenv PDSWAITTIME 6000 putenv PDUSER '"root"/"root"' putenv PDXAMODE 1 |
For details about the OpenTP1 system definition, see Chapter 5. System Definitions. For details about the environment variables to be specified and their settings, see the settings used for installing HiRDB and the manual Scalable Database Server HiRDB Version 7 UAP Development Guide, for Windows systems.
Use the trnstring transaction service definition command to specify the information required in order to access the resource manager. When you link OpenTP1 with HiRDB, specify the -n option and, if necessary, the -d option in the trnstring definition command.
There is no need to specify the xa_open and xa_close function strings (specified in the -o, -O, -c, and -C options in the trnstring definition command).
The following shows an example of a transaction service definition:
trnstring -n HiRDB_DB_SERVER |
When you compile and link a UAP that accesses HiRDB, you must use the trnmkobj command to link the transaction control object created under %DCDIR%\spool\trnrmcmd\userobj.
For details about how to compile and link UAPs, see 3.2 Compiling and linking UAPs, the edition of the manual OpenTP1 Programming Reference for the applicable language, and the Scalable Database Server HiRDB Version 7 UAP Development Guide, for Windows systems. For details about the trnmkobj command, see Chapter 7. Operation Commands.
The following shows examples of creating a transaction control object for UAPs that access HiRDB in C language and in COBOL.
trnmkobj -o rm_obj -r HiRDB_DB_SERVER |
trnmkobj -o rm_obj -C "/Zl" -r HiRDB_DB_SERVER |
This subsection presents an example of a makefile that is used when an SPP is created in C language.
The source file names used in the example makefile are as follows:
The following shows an example of a makefile:
NODEBUG = 1 !include <ntwin32.mak> #TP1TEST Make File SYSLIB = $(conlibsdll) TP1LIB = [libdam.lib]#1 [libtam.lib]#2 libbetran.lib HIRDBLIB = pdcltx32.lib all:TP1TEST.exe # Compile exmain.obj:exmain.c $(cc) $(cflags) $(cvarsdll) $*.c exsv1.obj:exsv1.c $(cc) $(cflags) $(cvarsdll) $*.c exsv2.obj:exsv2.c $(cc) $(cflags) $(cvarsdll) $*.c ex_sstb.obj:ex_sstb.c $(cc) $(cflags) $(cvarsdll) $*.c exproc.obj:exproc.c $(cc) $(cflags) $(cvarsdll) $*.c # Create a stub source file ex_sstb.c:ex.def $(DCDIR)\bin\stbmake $? # Precompile exproc.c:exproc.ec $(PDDIR)\client\utl\pdcpp /XA $? # Link TP1TEST.exe: exmain.obj exsv1.obj exsv2.obj ex_sstb.obj exproc.obj $(link) $(conflags) -out:$*.exe $** \ [$(DCDIR)\spool\trnrmcmd\userobj\rm_obj.obj \]#3 $(TP1LIB) $(SYSLIB) $(HIRDBLIB) |
This subsection presents an example of a makefile that is used when an SPP is created in COBOL.
The source file names used in the example makefile are as follows:
The following shows an example of a makefile:
!include <ntwin32.mak> #TP1TEST Make File CBLFG1 = -Compile,NoLink -Comp5 -Lib,CUI -SQL,ODBC -Main,System CBLFG2 = -Compile,NoLink -Comp5 -Lib,CUI -SQL,ODBC SYSLIB = $(conlibsdll) TP1LIB = [libdam.lib]#1 [libtam.lib]#2 libbetran.lib HIRDBLIB = pdcltx32.lib CCBL = ccbl2002 LK = ccbl2002 -Lib,CUI all:TP1TEST.exe # Compile main.obj:main.cbl $(CCBL) $(CBLFG1) main.cbl sev1.obj:sev1.cbl $(CCBL) $(CBLFG2) sev1.cbl sev2.obj:sev2.cbl $(CCBL) $(CBLFG2) sev2.cbl exprocb1.obj:exprocb1.cbl $(CCBL) $(CBLFG2) exprocb1.cbl exprocb2.obj:exprocb2.cbl $(CCBL) $(CBLFG2) exprocb2.cbl ex_sstb.obj:ex_sstb.c $(cc) $(cflags) /Zl $(cvarsdll) $*.c # Create a stub source file ex_sstb.c:ex.def $(DCDIR)\bin\stbmake $? # Precompile exprocb1.cbl:exprocb1.ecb $(PDDIR)\client\utl\pdcbl /XA $? exprocb2.cbl:exprocb2.ecb $(PDDIR)\client\utl\pdcbl /XA $? # Link TP1TEST.exe: main.obj sev1.obj sev2.obj ex_sstb.obj \ exprocb1.obj exprocb2.obj $(LK) -OutputFile $*.exe $** \ [$(DCDIR)\spool\trnrmcmd\userobj\rm_obj.obj \]#3 $(TP1LIB) $(SYSLIB) $(HIRDBLIB) |
All Rights Reserved. Copyright (C) 2012, Hitachi, Ltd.