Tmax 4GL Programming Guide (Power Builder, Delphi, Visual Basic, Visual Basic.net, C#.net) : TM4P-0702-06-380 : Tmax 3.8 : July 2, 2003 : Sep 20, 2003
Tmax 4Gl Programming Guide (Power Builder, Delphi, Visual Basic, Visual Basic.net, C#.net) Tmax 3.8 Tmax 4GL Programming Guide
Copyright (c) 2001 Tmax Soft Co., Ltd. All Rights Reserved.,,, Tmax Soft.,,,..... Tmax, WebT, WebtoB, JEUS, Host-Link, WebInOne Tmax Soft Co., Ltd.. Tmax 135-708 946-1 18 Tel: +82-2-6288-2114, 2006 Fax: +82-2-6288-2115 E-Mail: info@tmax.co.kr Tmax Administration Guide Document Edition Date Version TM4P-0621-05-380 JUN 21, 2002 Tmax 3.8 Tmax. Tmax Standard. 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 4GL Programming Guide
Tmax 4GL Programming GuidePower Builder, Delphi, Visual Basic,.net framework(visual Basic.net, C#.net) 4GL Tmax.,, 4GL Tmax. 4GL Application4GL Tmax.? Tmax 4GL Tmax. Tmax Tmax Reference ManualTmax Programming Guide.? 1. Power Builder : Power Builder Tmax. 2. Visual Basic : Visual Basic Tmax. 3. Delphi : Delphi Tmax. 4. Visual Basic.net : Visual Basic.net Tmax. 5. C#.net : C#.net Tmax. Tmax Reference Manual Tmax FDL Reference Manual Tmax Programming Guide { } [ ] ( ) Numeric String Literal abc abc Tmax 4GL Programming Guide
I. Power Builder... 7 1.... 8 2.... 9 pb_reset... 9 pb_tpalloc... 10 pb_tpstart... 13 pb_tmaxreadenv... 15 pb_tpend... 17 pb_tpcall... 18 pb_etpcall... 21 pb_tpfcall... 23 pb_tpacall... 25 pb_tpgetrply... 27 pb_tpcancel... 29 pb_tpcallw... 30 pb_tpconnect... 32 pb_tpsend... 34 pb_tprecv... 37 pb_tpdiscon... 40 pb_isblocked... 41 pb_tpbroadcast... 42 pb_tpsetunsol... 44 pb_getunsold... 45 pb_tpget... 47 pb_tpgetunsol... 48 pb_tpput... 49 f_data... 50 f_datadel... 51 f_fdata... 52 f_fdatadel... 53 f_form... 54 f_getdata... 55 pb_tx_begin... 56 pb_tx_commit... 57 pb_tx_rollback... 58 pb_tx_info... 59 pb_tx_set_commit_return... 60 pb_tx_set_transaction_control... 61 pb_tx_set_transaction_timeout... 62 tp_init... 63 tuxreadenv... 64 tp_term... 65 tp_call... 66 Tmax 4GL Programming Guide
tp_fcall... 68 tp_acall... 70 tp_getrply... 71 tp_cancel... 73 tuxcall... 74 tp_connect... 76 tp_conv... 78 tp_send... 80 tp_recv... 82 tp_discon... 84 isblocked... 85 tp_broadcast... 86 tp_subscribe... 88 tp_unsubscribe... 89 tp_begin... 90 tp_commit... 91 tp_abort... 92 3. Power Builder Sample... 93 II. Visual Basic...111 1.... 112 2.... 113 PUTINT... 113 PUTLONG... 114 PUTFLOAT... 115 PUTDOUBLE... 116 PUTVAR... 117 PUTCAR_BA... 118 PUTSTR... 120 PUTCHR... 121 PUTCAR... 122 GETINT... 123 GETLONG... 124 GETFLOAT... 125 GETDOUBLE... 126 GETVAR... 127 GETCAR_BA... 128 GETSTR... 129 GETCHR... 130 GETCAR... 131 TmaxError... 132 FdlErrorMsg... 133 FilltpstartBuf... 134 3. Visual Basic Sample... 135 III. Delphi... 164 1.... 165 Tmax 4GL Programming Guide
2. Delphi Sample... 166 IV. Visual Basic.net... 192 1.... 193 2.... 194 ErrorMsg... 194 FdlErrorMsg... 195 PUTINT... 196 PUTLONG... 197 PUTDOUBLE... 198 PUTFLOAT... 199 PUTSHORT... 200 PUTCAR3... 201 PUTVAR... 203 PUTCHR... 204 PUTCAR... 205 PUTCAR2... 206 GETINT... 207 GETLONG... 208 GETDOUBLE... 209 GETFLOAT... 210 GETSHORT... 211 GETCAR3... 212 GETVAR... 213 GETCHR... 214 GETCAR... 215 GETCAR2... 216 FilltpstartBuf... 217 3. Visual Basic.NET Sample... 218 V. C#.net... 259 1.... 260 2. C#.NET Sample... 261 Tmax 4GL Programming Guide
I. Power Builder Tmax 4GL Programming Guide
1. Tmax. (tmax.pbd).. -.,. tmax.pbd. tmax.pbd. Tmax 4GL Programming Guide
2. pb_reset long ret u_tmax uo_tmax uo_tmax = CREATE u_tmax uo_tmax.usr_name = 'tmaxclient' uo_tmax.clt_name = 'cilent01' uo_tmax.dom_pwd = 'tmax' uo_tmax.usr_pwd = 'client01' uo_tmax.flags = uo_tmax.tpunsol_ign ret = uo_tmax.pb_tpstart() if ret < 0 then error processing end if Tmax 4GL Programming Guide
pb_tpalloc svcname : itype : ) STRUCT, STRING, CARRAY, FIELD isubtype : ilen : size ( : 1024) long ret Tmax 4GL Programming Guide
long buf u_tmax uo_tmax uo_tmax = CREATE u_tmax uo_tmax.usr_name = 'tmaxclient' uo_tmax.clt_name = 'cilent01' uo_tmax.dom_pwd = 'tmax' uo_tmax.usr_pwd = 'client01' uo_tmax.flags = uo_tmax.tpunsol_ign ret = uo_tmax.pb_tpstart() if ret < 0 then error processing end if Tmax 4GL Programming Guide
tpbegin long ret u_tmax uo_tmax uo_tmax = CREATE u_tmax uo_tmax.usr_name = 'tmaxclient' uo_tmax.clt_name = 'cilent01' uo_tmax.dom_pwd = 'tmax' uo_tmax.usr_pwd = 'client01' uo_tmax.flags = uo_tmax.tpunsol_ign ret = uo_tmax.pb_tpstart() if ret < 0 then error processing end if uo_tmax.pb_tpbegin Tmax 4GL Programming Guide
pb_tpstart pb_tpstart() returns integer Tmax Tmax. IP (TMAX_ HOST_ADDR), (TMAX_HOST_PORT), SDLFILE, FIELD(FDL) FDLFILE. < > 1. dos autoexec.bat. : SET TMAX_HOST_ADDR=192.168.0.1 SET TMAX_HOST_PORT=8888 SET SDLFILE=C:\tmax\sdl\tmax.sdl SET FDLFILE=C:\tmax\fdl\tmax.fdl 2. unix(ksh).profile. : export TMAX_HOST_ADDR=192.168.0.1 export TMAX_HOST_PORT=8888 export SDLFILE=C:\tmax\sdl\tmax.sdl export FDLFILE=C:\tmax\fdl\tmax.fdl IP FIELD IP FIELD pb_tpstart() u_tmaxinstance. usr_name clt_name dom_pwd usr_pwd flags TPUNSOL_IGN TPUNSOL_POLL (pb_tpgetunsol() TPUNSOL_HND (pb_tpsetunsol(), pb_getunsold() long ret u_tmax uo_tmax uo_tmax = CREATE u_tmax uo_tmax.usr_name = 'tmaxclient' uo_tmax.clt_name = 'cilent01' uo_tmax.dom_pwd = 'tmax' uo_tmax.usr_pwd = 'client01' uo_tmax.flags = uo_tmax.tpunsol_ign Tmax 4GL Programming Guide
ret = uo_tmax.pb_tpstart() if ret < 0 then error processing end if Integer. -1 tperrnoerror. Tmax Reference Manualtpstart(). Tmax 4GL Programming Guide
pb_tmaxreadenv pb_tmaxreadenv(string env_file, string section) returns integer long ret u_tmax uo_tmax uo_tmax = CREATE u_tmax ret = uo_tmax.pb_tmaxreadenv(./tmax.env, "TMAX") if ret < 0 then error processing end if Tmax 4GL Programming Guide
Integer. -1 tperrnoerror. Tmax Reference Manualtmaxreadenv(). Tmax 4GL Programming Guide
pb_tpend pb_tpend() returns integer long ret u_tmax uo_tmax uo_tmax = CREATE u_tmax ret = uo_tmax.pb_tpend() if ret < 0 then error processing end if Integer. -1 tperrnoerror. Tmax Reference Manualtpend(). Tmax 4GL Programming Guide
pb_tpcall pb_tpcall(string svcname, string itype, string idata, string from[], ref string odata[]) returns integer. idata svcname. form columndataodata. svcname : itype : TAB( ~t ) NewLine( ~n ) ) - STRUCT itype = STRUCT~tstruct_name~n - STRING itype = STRING~t~n - FIELD KEY itype = FIELD~t~n idata : TAB NewLine form : odata STRUCT FIELD KEY Field., Field Newline Newline form. Form Newline form. odata : PowerBuilderImportString DataWindow TAB, RowNewLine. TmaxInstance flagstimeout. msg : message tperrno : tpurcode : User Code(tpreturn ) flags : pb_tpcall flag TPNOTRAN non transaction mode Tmax 4GL Programming Guide
TPNOCHANGE TPNOBLOCK non Blocking Mode TPNOTIME Blocking timeout timeout : pb_tx_set_transaction_timeout Blocking timeout - STRUCT string itype, input, form[], output[] int ret itype = "STRUCT~t" + "kstrdata~n" input = string(len(before.text)) + ~t + before.text + ~n form[1] = "len" + ~n + & "sdata" + ~n + & ~n form[2] = ~n output[1] = space(1024) uo_tmax.flags = uo_tmax.tpnochange uo_tmax.timeout = 50 ret = uo_tmax.pb_tpcall("sync", itype, input, form, output) if ret < 0 then messagebox( "ERROR","tpcall Failed : Error Code =" + string(uo_tmax.tperrno) ) return end if afterlen.text = uo_tmax.f_getdata(form[1], output[1], 1, "len") afterdata.text = uo_tmax.f_getdata(form[1], output[1], 1, "sdata") - FIELD KEY long ret string itype, input, form[], output[] if isnull(sle_1.text) or sle_1.text = '' then end if itype = "FIELD~t~n" input = "INPUT~t" + sle_1.text + "~n" form[1] = "OUTPUT~n~n" form[2] = "~n" output[1] = space(40) ret = uo_tmax.pb_tpcall("fdltoupper", itype, input, form[], output[]) Tmax 4GL Programming Guide
if ret < 0 then error processing end if Tmax Reference Manual tpcall(). pb_tpacall, pb_tpgetrply Tmax 4GL Programming Guide
pb_etpcall pb_etpcall(string svcname, string itype, string idata, string from[], ref string odata[]) returns integer pb_tpcall pb_tpcall. FILENAM, NEWFILE. TP_BITMAP CARRAY. FILENAM input ( 4M ) TP_BITMAP. NEWFILE idata. TP_BITMAP NEWFILE. NEWFILE. svcname : itype : TAB( ~t ) NewLine( ~n ) idata : TAB NewLine ) - input = "FILENAM~t" + FileName + "~n" - input = "NEWFILE~t" + FileName + "~n" form : odata STRUCT FIELD KEY Field., Field Newline Newline form. Form Newline form. odata : PowerBuilderImportString DataWindow TAB Tmax 4GL Programming Guide
, RowNewLine. TmaxInstance flagstimeout. msg : message tperrno : tpurcode : User Code(tpreturn ) flags : pb_tpcall flag TPNOTRAN non transaction mode TPNOCHANGE TPNOBLOCK non Blocking Mode TPNOTIME Blocking timeout timeout : pb_tx_set_transaction_timeout Transaction Time- Out long ret string itype, idata, form[], odata[] string FileName = "c:\abc.bmp" if isnull(sle_1.text) or sle_1.text = '' then error processing end if itype = "FML~t~n" /*FILEupload FILENAM.*/ idata = "FILENAM~t + FileName + ~n form[1] = "~n" odata[1] = space(1024) ret = uo_tmax.pb_etpcall("imgsave", itype, idata, form[], odata[]) if ret < 0 then error processing end if Tmax 4GL Programming Guide
pb_tpfcall pb_tpfcall ( string svcname, string itype, string idata, string form[], ref string odata[], string ifilename, string fform[], ref string fodata[] ) returns integer pb_tpcall(). Tmax FILED form output fform fodata. TAB( ~t ) NewLine( ~n ) TAB NewLine odata STRUCT FIELD KEY Field., Field Newline Newline form. Form Newline form. PowerBuilderImportString DataWindow TAB, RowNewLine. TAB NewLine FIELD_NAME1+ ~t + VALUE1+ ~n + & FIELD_NAME2+ ~t + VALUE2+ ~n + & ~n fodata STRUCT FIELD KEY Field., Field Newline Newline form. Form Newline form. Tmax 4GL Programming Guide
... InputFile = c:\temp\fdata0.txt InputFile = FileOpen(InputFile, StreamMode!, Write!, LockReadWrite!, Replace!)... uo_tmax.f_fdata(dw_input, InputFile) if FileClose(InputFile) <> 1 then error processing end if... ret = uo_tmax.pb_tpfcall( FCALL, itype, input, form, output, inputfilename, fform, foutput) if ret = -1 then error processing end if... f_fdata Tmax 4GL Programming Guide
pb_tpacall pb_tpacall ( string svcname, string itype, string idata ) returns integer,. (pb_tpgetrply())pb_tpacall(). pb_tpacall(). pb_tpgetrply(). TAB( ~t ) NewLine( ~n ) TAB NewLine string input, itype, form[], output[] int length, cd, ret length = len(before.text) itype = "STRUCT~tkstrdata~n" input = string(length) + ~t + before.text + ~n form[1] = "len~n" + "sdata~n" + ~n form[2] = ~n output[1] = space(1024) cd = uo_tmax.pb_tpacall("sync", itype, input) if cd < 0 then error processing end if ret = uo_tmax.pb_tpgetrply(cd, form, output) if ret < 0 then error processing end if (pb_tpgetrply() ). Tmax 4GL Programming Guide
pb_tpgetrply, pb_tpcancel, pb_tpcall Tmax 4GL Programming Guide
pb_tpgetrply pb_tpgetrply ( integer cd, ref string form[], ref string odata[] ) returns integer pb_tpgetrply()pb_tpacall(). pb_tpgetrply().. tperrnotpetime. cdpb_tpacall(),. form outputpb_tpcall(). pb_tpacall(). form : odata STRUCT FIELD KEY Field., Field Newline Newline form. Form Newline form. odata : PowerBuilderImportString DataWindow TAB, RowNewLine. string input, itype, form[], output[] int length, cd, ret length = len(before.text) itype = "STRUCT~tkstrdata~n" input = string(length) + ~t + before.text + ~n form[1] = "len~n" + "sdata~n" + ~n form[2] = ~n output[1] = space(1024) cd = uo_tmax.pb_tpacall("sync", itype, input) if cd < 0 then error processing end if ret = uo_tmax.pb_tpgetrply(cd, form, output) if ret < 0 then error processing Tmax 4GL Programming Guide
end if Integer. -1 tperrnoerror, msg. Tmax Reference Manual tpgetrply(). f_form, pb_tpacall, pb_tpcancel, pb_tpcall Tmax 4GL Programming Guide
pb_tpcancel pb_tpcancel ( integer cd ) returns integer pb_tpcancel()pb_tpacall().. cd. commit rollback. pb_tpacall() string input, itype, form[], output[] int length, cd, ret length = len(before.text) itype = "STRUCT~tkstrdata~n" input = string(length) + ~t + before.text + ~n form[1] = "len~n" + "sdata~n" + ~n form[2] = ~n output[1] = space(1024) cd = uo_tmax.pb_tpacall("sync", itype, input) if cd < 0 then error processing end if ret = uo_tmax.pb_tpcancel(cd) if ret < 0 then error processing end if Integer. -1 tperrnoerror, msg. Tmax Reference Manual tpcancel(). pb_tpacall, pb_tpgetrply Tmax 4GL Programming Guide
pb_tpcallw pb_tpcallw ( string svcname, powerobject iobject[], powerobject oobject[] ) returns integer iobject PowerObject Service, oobject PowerObject. iobject PowerObject oobject Power Object FIELD. input Object : Control Control.tag FIELD Field. DataWindow, DataWindowChild, : column FIELD FIELD. Row data. DataStore SingleLineEdit, MultiLineEdit : Control.Tag FIELD Field. Control.Textdata. StaticText, EditMask : Control.Tag FIELD Field. Control.Textdata. ListBox Control.Tag FIELD Field. data. DropDownListBox Control.Tag FIELD Field. data. CheckBox Control.Tag FIELD Field. Check data. RadioButton Control.Tag FIELD Field. Check data. outputobject input. ListBoxDropDownListBox data. uo_tmaxinstance Append TRUE, output DataWindow, DataWindow. FALSE DelBuf TRUE, inputdatawindow, DataWindow Delete Buffer (Primary Buffer ). Tmax 4GL Programming Guide
TRUE DataOnFail TRUE,. FALSE AppData pb_tpcall() input. DateFmt, Date/Time/DateTime, String TimeFmt, Format. DateTimeFmt pb_tpcallw pb_tpcall, pb_tpcall. long ret windowobject indata[], outdata[] indata[1] = dw_1 indata[2] = sle_input outdata[1] = dw_2 uo_tmax.flags = 0; ret = uo_tmax.pb_tpcallw ("SVC1", indata, outdata) if ret < 0 then error processing end if pb_tpcall, tuxcall Tmax 4GL Programming Guide
pb_tpconnect pb_tpconnect ( string svcname, string itype, string idata, long arg_flag ) returns integer pb_tpconnect(). pb_tpsend(), pb_tprecv(). Tmax Reference Manualtpconnect(). TAB( ~t ) NewLine( ~n ) TAB NewLine. TPNOTRAN : pb_tpconnect() svc, svc. svc, pb_tpconnect() TPNOTRAN. pb_tpconnect(), TPNOTRAN (timeout). TPNOTRAN,. TPSENDONLY :,,.,. TPSENDONLY TPRECVONLY. TPRECVONLY :,,.,. TPSENDONLY TPRECVONLY. Tmax 4GL Programming Guide
TPNOTIME : TPNOTIME. pb_tpconnect() Blocking timeout. TPSIGSTRT : (signal)..,, tperrno TPGOTSIG. int ret, cd string itype, otype, idata, form[], odata[] itype = "STRING~t~n" otype = "STRING~t~n" idata = string(len(before.text)) + ~t + before.text + ~n odata[1] = space(1024) cd = uo_tmax.pb_tpconnect("conv", itype, idata, uo_tmax.tprecvonly) if cd < 0 then error processing end if ret = uo_tmax.pb_tprecv(cd, form, odata, uo_tmax.tpflags) if ret < 0 then if uo_tmax.revent <> uo_tmax.tpev_sendonly or & uo_tmax.revent = uo_tmax.tpev_svcsucc then error processing end if end if Integer. -1 tperrnoerror.. Tmax Reference Manualtpconnect(). pb_tpsend, tp_tprecv, pb_tpdiscon Tmax 4GL Programming Guide
pb_tpsend pb_tpsend ( integer cd, string itype, string idata, long arg_flag ) returns integer pb_tpsend().. Tmax Reference Manualtpsend(). pb_tpconnect() TAB( ~t ) NewLine( ~n ) TAB NewLine. TPRECVONLY : TPRECVONLY,., pb_tpsend(). pb_tprecv(), TPEV_SENDONLY. pb_tprecv(). TPNOBLOCK : (, ). TPNOBLOCK pb_tpsend(), ( ). TPNOTIME : TPNOTIME. pb_tpconnect(). Tmax 4GL Programming Guide
TPSIGSTRT : (signal)..,, tperrno TPGOTSIG. int ret, cd string itype, otype, idata, form[], odata[] itype = "STRING~t~n" otype = "STRING~t~n" idata = string(len(before.text)) + ~t + before.text + ~n odata[1] = space(1024) cd = uo_tmax.pb_tpconnect("conv", itype, idata, uo_tmax.tpsendonly) if cd < 0 then error processing end if ret = uo_tmax.pb_tpsend(cd, itype, idata, uo_tmax.tprecvonly) if ret < 0 then error processing endif,. -1,. tperrnopb_tpeevent( 22) revent pb_tpdiscon().. TPFAILtpreturn. reventpb_tpev_svcsucc, PB_TPEV_SVCFAIL tpurcoode. -1 tperrnoerror (PB_TPEEVENT Tmax 4GL Programming Guide
). Tmax Reference Manualtpsend(). pb_tpconnect, tp_tprecv, pb_tpdiscon Tmax 4GL Programming Guide
pb_tprecv pb_tprecv ( integer cd, ref string form[], ref string odata[], long arg_flag ) returns integer pb_tprecv().. Tmax Reference Manualtprecv(). pb_tpconnect() odata STRUCT FIELD KEY Field., Field Newline Newline form. Form Newline form. PowerBuilderImportString DataWindow TAB, RowNewLine.. TPNOBLOCK :., return.. TPNOTIME :. pb_tprecv() Blocking timeout. TPSIGRSTRT : (signal)..,, tperrno TPGOTSIG. int ret, cd string itype, otype, idata, form[], odata[] itype = "STRING~t~n" otype = "STRING~t~n" Tmax 4GL Programming Guide
idata = string(len(before.text)) + ~t + before.text + ~n odata[1] = space(1024) cd = uo_tmax.pb_tpconnect("conv", itype, idata, uo_tmax.tpsendonly) if cd < 0 then error processing end if ret = uo_tmax.pb_tprecv(cd, form, odata, uo_tmax.tpnoflags) if ret < 0 then if uo_tmax.revent <> uo_tmax.tpev_sendonly or & uo_tmax.revent = uo_tmax.tpev_svcsucc then error processing end if end if,. -1,. tperrnopb_tpeevent( 22) revent pb_tpdiscon()... TPFAILtpreturn SUCCESS ( ) reventpb_tpev_svcsucc, PB_TPEV_SVCFAIL tpurcoode. -1 tperrnoerror (PB_TPEEVENT ). Tmax Reference Manualtprecv(). Tmax 4GL Programming Guide
pb_tpconnect, tp_tprecv, pb_tpdiscon Tmax 4GL Programming Guide
pb_tpdiscon pb_tpdiscon ( integer cd ) returns integer pb_tpdiscon(), TPEV_DISCONIMM.. Tmax Reference Manualtpdiscon(). pb_tpconnect() int ret, cd string itype, otype, idata, form[], odata[] itype = "STRING~t~n" otype = "STRING~t~n" idata = string(len(before.text)) + ~t + before.text + ~n odata[1] = space(1024) cd = uo_tmax.pb_tpconnect("conv", itype, idata, uo_tmax.tpsendonly) if cd < 0 then error processing end if ret = uo_tmax.pb_tpdiscon(cd) if ret < 0 then error processing end if Integer. -1 tperrnoerror. Tmax Reference Manualtpdiscon(). pb_tpconnect, tp_tpsend, pb_tprecv Tmax 4GL Programming Guide
pb_isblocked pb_isblocked ( ) returns integer Blocking. Blocking Service. Service Service. Service button ( button ) Service. Service button. ret = uo_tmax.pb_isblocked() if ret = 0 then MessageBox("pb_isBlocked", "NO BLOCK " + string(uo_tmax.tperrno)) else MessageBox("pb_isBlocked", "BLOCKING") end if Integer. Blocking 1return. IsBlocked Tmax 4GL Programming Guide
pb_tpbroadcast pb_tpbroadcast ( string nodename, string usrname, string cltname, string data ) returns integer Client Message. nodename : Message. usrname : Message. pb_tpstart() usrname Message. cltname : Message. pb_tpstart() cltname Message. idata : TAB NewLine nodename, usrname, cltname. (wildcards). usrnamecltname?* nodename *. NULL,. Tmax Reference Manualtpbroadcast(). string nodename, usrname, cltname, data int ret. nodename = tmax usrname = * cltname = * data = sle_input.text ret = uo_tmax.pb_tpbroadcast(nodename, usrname, cltname, data) if ret < 0 then error processing end if Tmax Reference Manualtpbroadcast(). Tmax 4GL Programming Guide
- Tmax 4GL Programming Guide
pb_tpsetunsol pb_tpsetunsol ( unsignedinteger hwnd, string ename, unsignedinteger mid, long arg_flags ) returns integer. pb_getunsold(). hwnd : ename : tppost. mid : arg_flags :. TPBROADCAST, TPSENDTOCLI. pb_tpsetunsol(), pb_getunsold() u_tmaxinstance flagstpunsol_hndpb_tpstart(). uo_tmax.flags = uo_tmax.tpunsol_hnd ret = uo_tmax.pb_tpsetunsol ( HANDLE(this),, 1025, uo_tmax.tpbroadcast ) if ret = -1 then error processing end if unsoldata = space(1024) ret = uo_tmax.pb_getunsold(unsoldata, rlen, 1025) if ret < 0 then error processing end if TPEINVAL :. (16). pb_getunsold Tmax 4GL Programming Guide
pb_getunsold pb_getunsold ( ref string odata, integer len, unsignedinteger mid ) returns integer pb_tpsetunsol() pb_getunsold() odata :. len : mid : pb_tpsetunsol(), pb_getunsold() u_tmaxinstance flagstpunsol_hndpb_tpstart(). uo_tmax.flags = uo_tmax.tpunsol_hnd ret = uo_tmax.pb_tpsetunsol ( HANDLE(this),, 1025, uo_tmax.tpbroadcast ) if ret = -1 then error processing end if unsoldata = space(1024) ret = uo_tmax.pb_getunsold(unsoldata, rlen, 1025) if ret < 0 then error processing end if TPEINVAL : rcvbufnull mid 0. TPEITYPE :. TPEOTYPE :. TPEMATCH : mid. Tmax 4GL Programming Guide
pb_tpsetunsol Tmax 4GL Programming Guide
pb_tpget argument argument argumentsize. char * long addresspb.dll pb.dll string argument input. buf : long. loc : pb.dll loc. size :. TPEINVAL : rcvbufnull mid 0. TPEITYPE TPEOTYPE TPEMATCH pb_tpput Tmax 4GL Programming Guide
pb_tpgetunsol pb_tpgetunsol ( integer types, string form[], ref string odata[], integer arg_flags ) returns integer. pb_tpsetunsol() blocking. Tmax Reference Manualtpgetunsol(). types :. TPBROADCAST, TPSENDTOCLI. form : form. odata :. arg_flags : TPBLOCK pb_tpgetunsol(). TPNOTIME pb_tpgetunsol(). string form[], tmp[] tmp[1] = space(30) ret = uo_tmax.pb_tpgetunsol(uo_tmax.tpbroadcast, form[], tmp[], uo_tmax.tpblock) if ret < 0 then error processing end if TPEINVAL : rcvbufnull mid 0. TPEITYPE TPEOTYPE TPEMATCH pb_tpsetunsol, pb_getunsold Tmax 4GL Programming Guide
pb_tpput argument argument argument size. buf : long. loc :. size :. TPEINVAL : rcvbufnull mid 0. TPEITYPE TPEOTYPE TPEMATCH pb_tpget Tmax 4GL Programming Guide
f_data f_data ( {DataWindow DataWindowChild Datastore} ds_in ) returns string data. DataWindow( DataWindowChild, DataStore) Column datatab( ~t ), Column -Data NewLine( ~n ). Stringpb_tpcall input. ds_in : PowerBuilder Object (DataWindow, DataWindowChild, DataStore ) DataWindow( DataWindowChild, DataStore)data Row. string itype, input, form[], output[] itype = "STRING~t~n" input = uo_tmax.f_data(dw_input) + & ~n ret = uo_tmax.pb_tpcall("toupper", itype, input, form[], output[]) if ret < 0 then error processing end if String. DataWindow( DataWindowChild, DataStore) column data TAB( ~t )NewLine( ~n ). f_datadel, f_fdatadel, pb_tpcall, pb_tpacall, pb_tpconnect Tmax 4GL Programming Guide
f_datadel f_datadel ( {DataWindow DataWindowChild Datastore} ds_in ) returns string data. DataWindow( DataWindowChild, DataStore) Column datatab( ~t ), Column -Data NewLine( ~n ). Stringpb_tpcall input. ds_in : PowerBuilder Object (DataWindow, DataWindowChild, DataStore ) DeleteRow DeletedBufferdata : 1. DataWindow Allow Update ( Rows Menu Update Properties... Menu ) check. 2. ImportString ResetUpdate DeleteRow DeleteBuffer Row. string itype, input, form[], output[] itype = "STRING~t~n" input = uo_tmax.f_datadel(dw_input) + & ~n ret = uo_tmax.pb_tpcall("toupper", itype, input, form[], output[]) if ret < 0 then error processing end if String. DataWindow( DataWindowChild, DataStore)DeletedBuffer data TAB( ~t )NewLine( ~n ). f_fdata, f_fdatadel, pb_tpcall, pb_tpacall, pb_tpconnect Tmax 4GL Programming Guide
f_fdata f_fdata ( {Datastore DataWindow DataWindowChild} ds_in, integer filehandle ) returns integer Data. DataWindow( DataWindowChild, DataStore) RowColumn dataf_data format File Handle write., Column datatab( ~t ), Column -Data NewLine( ~n ). ds_in : PowerBuilder Object (DataWindow, DataWindowChild, DataStore ) filehandle : Service Data Field pb_tpfcall 4. DataWindow( DataWindowChild, DataStore)data Row.... InputFile = c:\temp\fdata0.txt InputFile = FileOpen(InputFile, StreamMode!, Write!, LockReadWrite!, Replace!)... uo_tmax.f_fdata(dw_input, InputFile) if FileClose(InputFile) <> 1 then error processing end if... if uo_tmax.tp_fcall(input, form, output, inputfilename, fform, foutput) = -1 then error processing end if... Integer. 1 0. File. f_data, f_datadel, f_fdatadel Tmax 4GL Programming Guide
f_fdatadel f_fdatadel ( {Datastore DataWindow DataWindowChild} ds_in, integer filehandle ) returns integer Data. DataWindow( DataWindowChild, DataStore) RowColumn dataf_data format File Handle write. ds_in : PowerBuilder Object (DataWindow, DataWindowChild, DataStore ) filehandle : DeleteRow DeletedBufferdata : 1. DataWindow Allow Update ( Rows Menu UpdateProperties... Menu ) check. 2. ImportString ResetUpdate DeleteRow DeleteBuffer Row. DataWindow( DataWindowChild, DataStore)dataDelete Buffer Row. f_fdata. - Integer. 1 0. File. f_data, f_datadel, f_fdata Tmax 4GL Programming Guide
f_form f_form ( {Datastore DataWindow DataWindowChild} ds_in) returns string form. DataWindow( DataWindowChild, DataStore) Column pb_tpcall4 String., column NewLine( ~n ) NewLine( ~n ). ds_in : PowerBuilder Object (DataWindow, DataWindowChild, DataStore ) string itype, input, form[], output[] itype = "STRING~t~n" input = uo_tmax.f_data(dw_input) + & ~n form[1] = uo_tmax.f_form(dw_input) ret = uo_tmax.pb_tpcall("toupper", itype, input, form[], output[]) if ret < 0 then error processing end if string. DataWindow(DataWindowChild, DataStore)Column NewLine( ~n ). pb_tpcall, pb_tpgetrply, pb_tprecv, pb_tpconv Tmax 4GL Programming Guide
f_getdata f_getdata ( string form, string odata, integer arg_row, string arg_col_name ) returns string form outputarg_row arg_col_name return. form : odata STRUCT FIELD KEY Field., Field Newline Newline form. Form Newline form. odata : PowerBuilderImportString DataWindow TAB, RowNewLine. arg_row : arg_col_name : string itype, input, form[], output[] itype = "STRING~t~n" input = uo_tmax.f_data(dw_input) + & ~n form[1] = uo_tmax.f_form(dw_input) ret = uo_tmax.pb_tpcall("toupper", itype, input, form[], output[]) if ret < 0 then error processing end if string.. - Tmax 4GL Programming Guide
pb_tx_begin pb_tx_begin ( ) returns integer., pb_tx_commit() pb_tx_rollback(). if _is_tx <> true then ret = uo_tmax.pb_tx_begin() if ret < 0 then error processing end if _is_tx = true end If Tmax Reference Manualtx_begin(). pb_tx_commit, pb_tx_rollback Tmax 4GL Programming Guide
pb_tx_commit pb_tx_commit ( ) returns integer commit. if _is_tx <> true then end if ret = uo_tmax.pb_tx_commit() if ret < 0 then error processing end If _is_tx = false Tmax Reference Manualtx_commit(). pb_tx_begin, pb_tx_rollback Tmax 4GL Programming Guide
pb_tx_rollback pb_tx_rollback ( ) returns integer rollback. ret = uo_tmax.pb_tpcall("insert", itype, input, form[], output[]) if ret < 0 then if _is_tx = true then ret = uo_tmax.pb_tx_rollback() if ret < 0 then error processing end if _is_tx = false end if error processing end if Tmax Reference Manualtx_rollback(). pb_tx_begin, pb_tx_commit Tmax 4GL Programming Guide
pb_tx_info pb_tx_info ( ) returns integer. xid u_tmaxdata, when_return, transaction_control, transaction_timeout transaction_stat. if _is_tx <> true then ret = uo_tmax.pb_tx_begin() if ret < 0 then error processing end if _is_tx = true end If if ret = uo_tmax.pb_tx_info() if ret < 0 then error processing end if Transaction mode 1 0. tperrnoerror. 1 TmaxInstance. data : ( :CLH :.) when_return : commit_return (pb_tx_set_commit_return() ) transaction_control : transaction control (pb_tx_set_transaction_control().) transaction_timeout : (pb_tx_set_transaction_timeout().) transaction_stat : Tmax Reference Manualtx_info(). pb_tx_begin, pb_tx_commit, pb_tx_rollback Tmax 4GL Programming Guide
pb_tx_set_commit_return pb_tx_set_commit_return ( long w_return ) returns integer when_return Global Transactioncommit. w_return :. TX_COMMIT_DECISION_LOGGED flagpb_tx_commit() two-phase commit protocol return.. TX_COMMIT_COMPLETED flagpb_tx_commit() two-phase commit protocol return. if ret = uo_tmax.pb_tx_set_commit_return(uo_tmax.tx_commit_completed) if ret < 0 then error processing end if if _is_tx <> true then ret = uo_tmax.pb_tx_begin() if ret < 0 then error processing end if _is_tx = true end If Tmax Reference Manualtx_set_commit_return(). pb_tx_info Tmax 4GL Programming Guide
pb_tx_set_transaction_control pb_tx_set_transaction_control ( long control ) returns integer control pb_tx_commit() pb_tx_rollback() transaction. control TX_UNCHAINED. control :. TX_UNCHAINED transaction. pb_tx_begin() transaction. TX_CHAINED pb_tx_commit() pb_tx_rollback() transaction. if ret = uo_tmax.pb_tx_set_transaction_control(uo_tmax.tx_chained) if ret < 0 then error processing end if if _is_tx <> true then ret = uo_tmax.pb_tx_begin() if ret < 0 then error processing end if _is_tx = true end If Tmax Reference Manual tx_set_transaction_control(). pb_tx_info Tmax 4GL Programming Guide
pb_tx_set_transaction_timeout pb_tx_set_transaction_timeout ( long timeout ) returns integer transactiontimeout. timeout :. if ret = uo_tmax.pb_tx_set_transaction_timeout(5) if ret < 0 then error processing end if if _is_tx <> true then ret = uo_tmax.pb_tx_begin() if ret < 0 then error processing end if _is_tx = true end If Tmax Reference Manual tx_set_transaction_timeout(). pb_tx_info Tmax 4GL Programming Guide
tp_init tp_init ( ) returns integer Tmax. pb_tpstart(). long ret u_tmax uo_tmax uo_tmax = CREATE u_tmax uo_tmax.usr_name = 'tmaxclient' uo_tmax.clt_name = 'cilent01' uo_tmax.dom_pwd = 'tmax' uo_tmax.usr_pwd = 'client01' uo_tmax.flags = uo_tmax.tpunsol_ign ret = uo_tmax.tp_initt() if ret < 0 then error processing end if pb_tpstart Tmax 4GL Programming Guide
tuxreadenv tuxreadenv ( string env_file, string section ) returns integer long ret u_tmax uo_tmax uo_tmax = CREATE u_tmax ret = uo_tmax.tuxreadenv(./tmax.env, "TMAX") if ret < 0 then error processing end if Integer. -1 tperrnoerror. Tmax 4GL Programming Guide
tp_term tp_term ( ) returns integer long ret u_tmax uo_tmax uo_tmax = CREATE u_tmax ret = uo_tmax.tp_term() if ret < 0 then error processing end if Integer. -1 tperrnoerror. Tmax 4GL Programming Guide
tp_call tp_call ( string idata, string form[], ref string odata[] ) returns integer idata Service, form column dataodata. tp_call() Tmax FILED(FDL) idata : service data. TAB NewLine form : odata Field Newline Newline form. Form Newline form. odata : PowerBuilderImportString DataWindow TAB, RowNewLine. TmaxInstance flagstimeout. msg : message tperrno : tpurcode : User Code(tpreturn ) flags : pb_tpcall flag TPNOTRAN non transaction mode TPNOCHANGE TPNOBLOCK non Blocking Mode TPNOTIME Blocking timeout timeout : pb_tx_set_transaction_timeout Blocking timeout input = SRVCNM + ~t + TOUPPER + ~n + & FIELD_NAME1 + ~t + VALUE1 + ~n + & FIELD_NAME2 + ~t + VALUE2 + ~n + & ~n form[1] = "OUTPUT~n~n" form[2] = "~n" output[1] = space(1024) Tmax 4GL Programming Guide
ret = uo_tmax. tp_call(input, form, output) if ret < 0 then error processing end if Integer. -1 tperrnoerror, msg. pb_tpcall, f_data, f_datadel, f_form, tuxcall Tmax 4GL Programming Guide
tp_fcall tp_fcall ( string idata, string form[], ref string odata[], string ifilename, string fform[], ref string foutdata[] ) returns integer tp_call(). Tmax FILED(FDL) form odata fform foutdata. service data. TAB NewLine odata Field Newline Newline form. Form Newline form. PowerBuilderImportString DataWindow TAB, RowNewLine. TAB NewLine fodata Field Newline Newline form. Form Newline form.... InputFile = c:\temp\fdata0.txt InputFile = FileOpen(InputFile, StreamMode!, Write!, LockReadWrite!, Replace!)... uo_tmax.f_fdata(dw_input, InputFile) if FileClose(InputFile) <> 1 then error processing end if... ret = uo_tmax.tp_fcall(input, form, output, inputfilename, fform, foutput) if ret = -1 then error processing Tmax 4GL Programming Guide
end if... Integer. -1 tperrnoerror, msg. pb_tpfcall, f_data, f_datadel, f_form Tmax 4GL Programming Guide
tp_acall tp_acall ( ref string idata ) returns integer. (tp_getrply() ).,. tp_acall() Tmax FIELD. service data. TAB NewLine string input, form[], odata[] int cd, ret input = SRVCNM + ~t + TOUPPER + ~n + & FIELD_NAME1 + ~t + VALUE1 + ~n + & FIELD_NAME2 + ~t + VALUE2 + ~n + & ~n form[1] = "OUTPUT~n~n" form[2] = "~n" output[1] = space(1024) cd = uo_tmax.tp_acall(input) if cd < 0 then error processing end if ret = uo_tmax.tp_getrply(cd, form, output) if ret < 0 then error processing end if (tp_getrply() ). pb_tpacall, tp_getrply Tmax 4GL Programming Guide
tp_getrply tp_getrply ( integer cd, ref string form[], ref string odata[] ) returns integer tp_getrply()tp_acall(). cdtp_acall(),. tp_getrply()tmax FIELD. form outputtp_call(). tp_acall(). form : odata Field Newline Newline form. Form Newline form. odata : PowerBuilderImportString DataWindow TAB, RowNewLine. string input, form[], odata[] int cd, ret input = SRVCNM + ~t + TOUPPER + ~n + & FIELD_NAME1 + ~t + VALUE1 + ~n + & FIELD_NAME2 + ~t + VALUE2 + ~n + & ~n form[1] = "OUTPUT~n~n" form[2] = "~n" output[1] = space(1024) cd = uo_tmax.tp_acall(input) if cd < 0 then error processing end if ret = uo_tmax.tp_getrply(cd, form, output) if ret < 0 then error processing end if Tmax 4GL Programming Guide
Integer. -1 tperrnoerror, msg. pb_tpgetrply, tp_acall Tmax 4GL Programming Guide
tp_cancel tp_cancel ( integer cd ) returns integer tp_cancel()tp_acall().. commit rollback. tp_acall() string input, form[], odata[] int cd, ret input = SRVCNM + ~t + TOUPPER + ~n + & FIELD_NAME1 + ~t + VALUE1 + ~n + & FIELD_NAME2 + ~t + VALUE2 + ~n + & ~n form[1] = "OUTPUT~n~n" form[2] = "~n" output[1] = space(1024) cd = uo_tmax.tp_acall(input) if cd < 0 then error processing end if ret = uo_tmax.pb_tpcancel(cd) if ret < 0 then error processing end if Integer. -1 tperrnoerror. tp_acall, tp_getrply Tmax 4GL Programming Guide
tuxcall tuxcall ( string svcname, powerobject sobject[], ref powerobject robject[] ) returns integer sobject PowerObject Service, robject PowerObject. tuxcall() Tmax FIELD. sobject Object. DataWindow, DataWindowChild, DataStore SingleLineEdit, MultiLineEdit StaticText, EditMask ListBox DropDownListBox CheckBox RadioButton : column FIELD FIELD. Row data. : Control.Tag FIELD Field. Control.Textdata. : Control.Tag FIELD Field. Control.Textdata. Control.Tag FIELD Field. data. Control.Tag FIELD Field. data. Control.Tag FIELD Field. Check data. Control.Tag FIELD Field. Check data. robjectobject input. ListBoxDropDownListBox data. u_tmaxinstance. dwappend : TRUE, robject DataWindow, DataWindow. FALSE dwdelbuf : TRUE, sobject DataWindow, DataWindowDelete Buffer (Primary Buffer ). TRUE DataOnFail : TRUE,. FALSE AuxData Tmax 4GL Programming Guide
DateFmt, TimeFmt, DateTimeFmt tp_call()input. Date/Time/DateTime, String Format. *tuxcall() tp_call(), tp_call(). long ret windowobject indata[], outdata[] indata[1] = dw_1 indata[2] = sle_input outdata[1] = dw_2 uo_tmax.flags = 0; ret = uo_tmax.tuxcall("svc1", indata, outdata) if ret < 0 then error processing end if Integer. -1 tperrnoerror, msg. tp_call, pb_tpcallw Tmax 4GL Programming Guide
tp_connect tp_connect ( string idata, long arg_flag ) returns integer tp_connect(). tp_send(),tp_recv(). tp_connect() Tmax FIELD. service data. TAB NewLine. TPNOTRAN : pb_tpconnect() svc, svc. svc, pb_tpconnect() TPNOTRAN. pb_tpconnect(), TPNOTRAN (timeout). TPNOTRAN,. TPSENDONLY :,,.,. TPSENDONLY TPRECVONLY. TPRECVONLY :,,.,. TPSENDONLY TPRECVONLY. TPNOTIME : TPNOTIME. pb_tpconnect(). Tmax 4GL Programming Guide
TPSIGSTRT : (signal)..,, tperrno TPGOTSIG. int ret, cd string idata idata = SRVCNM + ~t + CONV + ~n + & FIELD_NAME1 + ~t + VALUE1 + ~n + & FIELD_NAME2 + ~t + VALUE2 + ~n + & ~n cd = uo_tmax.tp_connect(idata, uo_tmax.tprecvonly) if cd < 0 then error processing end if Integer. -1 tperrnoerror.. tp_send, tp_recv, tp_conv, tp_discon Tmax 4GL Programming Guide
tp_conv tp_conv ( integer cd, string idata, ref string form[], ref string odata[], long arg_flag ) returns integer cd,. tp_conv() Tmax FIELD. tp_connect() service data. TAB NewLine odata Field Newline Newline form. Form Newline form. PowerBuilderImportString DataWindow TAB, RowNewLine. pb_tpsend(), pb_tprecv() flag. int ret, cd string idata idata = SRVCNM + ~t + CONV + ~n + & FIELD_NAME1 + ~t + VALUE1 + ~n + & FIELD_NAME2 + ~t + VALUE2 + ~n + & ~n form[1] = "OUTPUT~n~n" form[2] = "~n" output[1] = space(1024) cd = uo_tmax.tp_connect(idata, uo_tmax.tprecvonly) if cd < 0 then error processing end if ret = uo_tmax.tp_conv(cd, idata, form, output, uo_tmax.tpnoflags) if ret < 0 then if uo_tmax.revent <> uo_tmax.tpev_sendonly or & uo_tmax.revent = uo_tmax.tpev_svcsucc then error processing Tmax 4GL Programming Guide
end if end if,. -1,. tperrnopb_tpeevent( 22) revent pb_tpdiscon()... TPFAILtpreturn SUCCESS ( ) reventpb_tpev_svcsucc, PB_TPEV_SVCFAIL tpurcoode. -1 tperrnoerror (PB_TPEEVENT ). Tmax Reference Manualtpsend(). tp_connect, tp_discon, tp_send, tp_recv Tmax 4GL Programming Guide
tp_send tp_send ( integer cd, string idata, long arg_flag ) returns integer tp_send().. tp_send() Tmax FILED. pb_tpconnect() service data. TAB NewLine. TPRECVONLY : TPRECVONLY,., pb_tpsend(). pb_tprecv(), TPEV_SENDONLY. pb_tprecv(). TPNOBLOCK : (, ). TPNOBLOCK pb_tpsend(), ( ). TPNOTIME : TPNOTIME. pb_tpconnect(). TPSIGSTRT : (signal)..,, tperrno TPGOTSIG. Tmax 4GL Programming Guide
int ret, cd string itype, otype, idata, form[], odata[] idata = SRVCNM + ~t + CONV + ~n + & FIELD_NAME1 + ~t + VALUE1 + ~n + & FIELD_NAME2 + ~t + VALUE2 + ~n + & ~n cd = uo_tmax.tp_connect(idata, uo_tmax.tpsendonly) if cd < 0 then error processing end if ret = uo_tmax.tp_send(idata, uo_tmax.tprecvonly) if ret < 0 then error processing end if,. -1,. tperrnopb_tpeevent( 22) revent pb_tpdiscon().. TPFAILtpreturn. reventpb_tpev_svcsucc, PB_TPEV_SVCFAIL tpurcoode. -1 tperrnoerror (PB_TPEEVENT ). tp_connect, tp_discon, tp_recv, tp_conv Tmax 4GL Programming Guide
tp_recv tp_recv ( integer cd, ref string form[], ref string odata[], long arg_flag ) returns integer tp_recv().. tp_recv() Tmax FIELD. pb_tpconnect() odata Field Newline Newline form. Form Newline form. PowerBuilderImportString DataWindow TAB, RowNewLine.. TPNOBLOCK :., return.. TPNOTIME :. pb_tprecv(). TPSIGRSTRT : (signal)..,, tperrno TPGOTSIG. int ret, cd string itype, otype, idata, form[], odata[] idata = SRVCNM + ~t + CONV + ~n + & FIELD_NAME1 + ~t + VALUE1 + ~n + & FIELD_NAME2 + ~t + VALUE2 + ~n + & ~n Tmax 4GL Programming Guide
cd = uo_tmax.tp_connect(idata, uo_tmax.tprecvonly) if cd < 0 then error processing end if ret = uo_tmax.tp_recv(cd, form, odata, uo_tmax.tpnoflags) if ret < 0 then if uo_tmax.revent <> uo_tmax.tpev_sendonly or & uo_tmax.revent = uo_tmax.tpev_svcsucc then error processing end if end if,. -1,. tperrnopb_tpeevent( 22) revent pb_tpdiscon()... TPFAILtpreturn SUCCESS ( ) reventpb_tpev_svcsucc, PB_TPEV_SVCFAIL tpurcoode. -1 tperrnoerror (PB_TPEEVENT ). tp_connect, tp_discon, tp_send, tp_conv Tmax 4GL Programming Guide
tp_discon tp_discon ( integer cd ) returns integer tp_discon(), TPEV_DISCONIMM. tpreturn, client., abort. tp_connect() int ret, cd string idata idata = SRVCNM + ~t + CONV + ~n + & FIELD_NAME1 + ~t + VALUE1 + ~n + & FIELD_NAME2 + ~t + VALUE2 + ~n + & ~n cd = uo_tmax.tp_connect(idata, uo_tmax.tprecvonly) if cd < 0 then error processing end if ret = uo_tmax.tp_discon(cd) if ret < 0 then error processing end if Integer. -1 tperrnoerror. pb_tpconnect, tp_tpsend, pb_tprecv Tmax 4GL Programming Guide
isblocked isblocked ( ) returns integer Blocking. Blocking Service. Service Service. Service button ( button ) Service. Service button. ret = uo_tmax.isblocked() if ret = 0 then MessageBox("pb_isBlocked", "NO BLOCK " + string(uo_tmax.tperrno)) else MessageBox("pb_isBlocked", "BLOCKING") end if Integer. Blocking 1return. pb_isblocked Tmax 4GL Programming Guide
tp_broadcast tp_broadcast ( string nodename, string usrname, string cltname, string idata ) returns integer Client Message. nodename : Message. usrname : Message. pb_tpstart() usrname Message. cltname : Message. pb_tpstart() cltname Message. idata : service data. TAB NewLine nodename, usrname, cltname. (wildcards). usrnamecltname?* nodename *. NULL,. string nodename, usrname, cltname, data int ret. nodename = tmax usrname = * cltname = * data = SRVCNM + ~t + BROAD + ~n + & FIELD_NAME1 + ~t + VALUE1 + ~n + & ~n ret = uo_tmax.tp_broadcast(nodename, usrname, cltname, data) if ret < 0 then error processing end if Tmax 4GL Programming Guide
pb_tpbroadcast Tmax 4GL Programming Guide
tp_subscribe tp_subscribe ( unsignedinteger hwnd, string event_name, unsignedinteger message_id ) returns integer tppost(). event_name tppost() hwnd message_id., Message.WordParm ID. get_evtname() get_data() ID. tp_unsubscribe(). hwnd : event_name : message_id : ID - tp_unsubscribe Tmax 4GL Programming Guide
tp_unsubscribe tp_unsubscribe ( unsignedinteger hwnd ) returns integer tp_subscribe(), tp_setunsol() (hwnd) Message. hwnd : - tp_subscribe Tmax 4GL Programming Guide
tp_begin tp_begin ( unsignedlong timeout, long arg_flags ) returns integer., tp_commit() tp_abort(). timeout : transaction.( ) transaction timeout transactionabort. arg_flags :. if _is_tx <> true then ret = uo_tmax.tp_begin(10, 0) if ret < 0 then error processing end if _is_tx = true end If tp_commit, tp_abort Tmax 4GL Programming Guide
tp_commit tp_commit ( long arg_flags ) returns integer commit. arg_flags :. if _is_tx <> true then end if ret = uo_tmax.tp_commit(0) if ret < 0 then error processing end If _is_tx = false tp_begin, tp_abort Tmax 4GL Programming Guide
tp_abort tp_abort ( long arg_flags ) returns integer abort. arg_flags :. ret = uo_tmax.pb_tpcall("insert", itype, input, form[], output[]) if ret < 0 then if _is_tx = true then ret = uo_tmax.tp_abort(0) if ret < 0 then error processing end if _is_tx = false end if error processing end if. tp_begin, tp_commit Tmax 4GL Programming Guide
3. Power Builder Sample,,,,,,,. 8 singleline editor1, 6., 50.,,,. demo.pbl : client emp_c.pc : service (Oracle ) demo.f : Field Key Buffer emp_c.mk: Makefile tmconfig.m : Tmax - User Object : tmax.pbd - : FIELD KEY BUFFER fdlc fdl - : pb_tpcall() - :,,, - Tmax :,. - : FDLSELECT, FDLUPDATE, FDLDELETE, FDLINSERT - : SVRGROUP ( XA ) Tmax 4GL Programming Guide
< > < > Tmax 4GL Programming Guide
Global Variables u_tmax uo_tmax boolean btxrun, bconnect Window Fuctions tmaxconnect ( ) returns Boolean IF uo_tmax.pb_tpstart()<0 THEN st_err.text = (".\n tpstart() Failed: Error Code =" + string(uo_tmax.tperrno)) return FALSE END IF return TRUE inputcheck ( integer inputnum ) returns Boolean IF isnull( sle_empno.text ) OR sle_empno.text = "" THEN st_err.text = "." return FALSE END IF IF( inputnum = 1) THEN return TRUE IF isnull( sle_name.text ) OR sle_name.text = "" THEN goto errormsg IF isnull( sle_job.text ) OR sle_job.text = "" THEN goto errormsg IF isnull( sle_mgr.text ) OR sle_mgr.text = "" THEN goto errormsg IF (len(sle_date.text) <>8 ) THEN goto errormsg IF isnull( sle_sal.text ) OR sle_sal.text = "" THEN goto errormsg IF isnull( sle_comm.text ) OR sle_comm.text = "" THEN goto errormsg IF isnull( sle_dept.text ) OR sle_dept.text = "" THEN goto errormsg return TRUE errormsg: st_err.text = ", 8 (YYYYMMDD)." return FALSE clearwindow ( ) returns Boolean sle_empno.clear() sle_name.clear() sle_job.clear() sle_mgr.clear() sle_date.clear() sle_sal.clear() sle_comm.clear() sle_dept.clear() sle_empno.setfocus() Tmax 4GL Programming Guide
errorprocess ( string infomsg ) st_err.text = InfoMsg IF( btxrun = TRUE ) THEN uo_tmax.pb_tx_rollback() btxrun = FALSE END IF IF( bconnect = TRUE ) THEN uo_tmax.pb_tpend() bconnect = FALSE END IF successprocess ( string infomsg ) st_err.text = InfoMsg IF( btxrun = TRUE ) THEN uo_tmax.pb_tx_commit() btxrun = FALSE END IF IF( bconnect = TRUE ) THEN uo_tmax.pb_tpend() bconnect = FALSE END IF Open Script string FileName uo_tmax = CREATE u_tmax uo_tmax.flags = 0 FileName ="D:\PB\MyProgram\tmax.env" IF uo_tmax.pb_tmaxreadenv( FileName, "tmax1") <0 THEN messagebox( "Eviroment Error","Enviroment File Loading Failed : Error Code =" + string(uo_tmax.tperrno)) return END IF open(w_demo) Script string itype, idata, form[], odata[] IF(inputcheck(1) = FALSE) THEN return Tmax 4GL Programming Guide
itype = "FIELD~t~n" idata = "EMPNO"+"~t"+sle_empno.text+"~n" form[1] ="EMPNO~n" + & "ENAME~n" + & "JOB~n" + & "MGR~n" + & "DATE~n" + & "SAL~n" + & "COMM~n" + & "DEPTNO~n" + & "E_TYPE~nE_CODE~nE_MSG~nE_TMP~n~n" form[2] = "~n"//"e_type~ne_code~ne_msg~ne_tmp~n~n" odata[1] = space(1024) bconnect = tmaxconnect() IF bconnect = FALSE THEN errorprocess( ".") return END IF IF uo_tmax.pb_tpcall("fdlselect", itype, idata, form[], odata[]) <0 THEN errorprocess( uo_tmax.f_getdata(form[1], odata[1], 1, "E_MSG") ) return END IF dw_out.importstring(odata[1]) dw_out.visible = TRUE cb_back.visible = TRUE cb_sel.enabled = FALSE cb_udt.enabled = FALSE cb_del.enabled = FALSE cb_ins.enabled = FALSE cb_exit.enabled = FALSE successprocess( sle_empno.text + ".") Script string itype, idata, form[], odata[] IF(inputcheck(0) = FALSE) THEN return itype = "FIELD~t~n" idata = "EMPNO~t" +sle_empno.text+"~n" + & "ENAME~t"+sle_name.text+"~n" + & "JOB~t"+sle_job.text+"~n" + & "MGR~t"+sle_mgr.text+"~n" + & "DATE~t" +sle_date.text+"~n" + & Tmax 4GL Programming Guide
"SAL~t" +sle_sal.text+"~n" + & "COMM~t" +sle_comm.text+"~n" + & "DEPTNO~t" +sle_dept.text+"~n~n" form[1] = "E_TYPE~nE_CODE~nE_MSG~nE_TMP~n~n" form[2] = "~n" odata[1] = space(1024) bconnect = tmaxconnect() IF bconnect = FALSE THEN errorprocess( ".") return END IF IF btxrun = FALSE THEN IF uo_tmax.pb_tx_begin()<0 THEN errorprocess( "pb_tx_begin Error") return END IF btxrun = TRUE END IF IF uo_tmax.pb_tpcall("fdlupdate", itype, idata, form[], odata[])<0 THEN errorprocess( "Error:\n"+uo_tmax.f_getdata(form[1], odata[1], 1, "E_MSG") ) return END IF clearwindow() successprocess( sle_empno.text + "." ) Script int string ret itype, idata, form[], odata[] IF(inputcheck(1) = FALSE) THEN return itype = "FIELD~t~n" idata = "EMPNO"+"~t"+sle_empno.text+"~n~n" form[1] = "E_TYPE~nE_CODE~nE_MSG~nE_TMP~n~n" form[2] = "~n" odata[1] = space(1024); bconnect = tmaxconnect() IF bconnect = FALSE THEN errorprocess( ".") return END IF Tmax 4GL Programming Guide
IF btxrun = FALSE THEN IF uo_tmax.pb_tx_begin()<0 THEN errorprocess( "pb_tx_begin Error") return END IF btxrun = TRUE END IF IF uo_tmax.pb_tpcall("fdldelete", itype, idata, form[], odata[])<0 THEN errorprocess( uo_tmax.f_getdata(form[1], odata[1], 1, "E_MSG") ) return END IF successprocess( sle_empno.text + "." ) clearwindow() Script long string ret itype, idata, form[], odata[] IF(inputcheck(0) = FALSE) THEN return itype = "FIELD~t~n" idata = "EMPNO~t"+sle_empno.text+"~n" + & "ENAME~t"+sle_name.text+"~n" + & "JOB~t"+sle_job.text+"~n" + & "MGR~t"+sle_mgr.text+"~n" + & "DATE~t"+sle_date.text+"~n" + & "SAL~t"+sle_sal.text+"~n" + & "COMM~t"+sle_comm.text+"~n" + & "DEPTNO~t"+sle_dept.text+"~n" + & "~n" form[1] = "E_TYPE~nE_CODE~nE_MSG~nE_TMP~n~n" form[2] = "~n" odata[1] = space(1024); bconnect = tmaxconnect() IF bconnect = FALSE THEN errorprocess( ".") return END IF IF btxrun = FALSE THEN IF uo_tmax.pb_tx_begin()<0 THEN errorprocess( "pb_tx_begin Error") Tmax 4GL Programming Guide
return END IF btxrun = TRUE END IF IF uo_tmax.pb_tpcall("fdlinsert", itype, idata, form[], odata[])<0 THEN errorprocess( uo_tmax.f_getdata(form[1], odata[1], 1, "E_MSG") ) return END IF successprocess( sle_empno.text + "." ) clearwindow() Script close(w_demo) Script int i cb_sel.enabled = TRUE cb_udt.enabled = TRUE cb_del.enabled = TRUE cb_ins.enabled = TRUE cb_exit.enabled = TRUE FOR i=1 to (dw_out.rowcount()+2) dw_out.deleterow ( 1 ) NEXT clearwindow() dw_out.visible = FALSE cb_back.visible = FALSE Tmax 4GL Programming Guide
demo.f DataBase EMP Table EMPNO NUMBER NOT NULL P1 ENAME VARCHAR(16) JOB VARCHAR(16) MGR NUMBER HIREDATE DATE SAL NUMBER(7,2) COMM NUMBER(7,2) DEPTNO NUMBER Tmax 4GL Programming Guide
emp_c.pc Tmax 4GL Programming Guide
Tmax 4GL Programming Guide
Tmax 4GL Programming Guide
Tmax 4GL Programming Guide
Tmax 4GL Programming Guide
Tmax 4GL Programming Guide
} Tmax 4GL Programming Guide
emp_c.mk Tmax 4GL Programming Guide
tmconfig.m *DOMAIN dom1 *NODE tmax1 *SVRGROUP svg1 *SERVER emp_c *SERVICE FDLSELECT FDLUPDATE FDLDELETE FDLINSERT SHMKEY=70000, MAXUSER=200, MINCLH=1, MAXCLH=5, TPORTNO=8888, BLOCKTIME=200, TXTIME=200 TMAXDIR="/home/tmax", APPDIR="/home/tmax/appbin", PATHDIR="/home/tmax/path", TLOGDIR= "/home/tmax/log/tlog", SLOGDIR="/home/tmax/log/slog" ULOGDIR="/home/tmax/log/ulog" NODENAME=tmax1, DBNAME=ORACLE, OPENINFO="ORACLE_XA+Acc=P/scott/tiger+SesTm=60", TMSNAME = svg1_tms SVGNAME=svg1, MIN=1 SVRNAME= emp_c SVRNAME= emp_c SVRNAME= emp_c SVRNAME= emp_c Tmax 4GL Programming Guide
II. Visual Basic Tmax 4GL Programming Guide
1... atmi.bas fdl. Bas comm..bas winapi.bas : atmi : : : windows Tmax.. (comm.bas). atmi Tmax Reference Manual Tmax Programming Guide.. Tmax 4GL Programming Guide
2. PUTINT Function PUTINT(ByVal Fdlptr&, Field As String, idx As Long, idata As Integer) As Long FIELD(FDL) Field Integer idata idx. Fdlptr : FDL Field : idx : idata : Dim lsendbuf As Long Dim lret As Long Dim intdata As Integer lsendbuf = tpalloc("field ", "", 0) lret = PUTINT(ByVal lsendbuf, "INTDATA", 0, intdata) PUTLONG, PUTDOUBLE, PUTVAR, PUTCAR, PUTFLOAT, PUTSTR, PUTCHR Tmax 4GL Programming Guide
PUTLONG Function PUTLONG(ByVal Fdlptr&, Field As String, idx As Long, ldata As Long) As Long FIELD(FDL) Field Long ldata idx. Fdlptr : FDL Field : Idx : LData : Dim lsendbuf As Long Dim lret As Long Dim longdata As Long lsendbuf = tpalloc("field ", "", 0) lret = PUTLONG(ByVal lsendbuf, "LONGDATA", 0, longdata) PUTINT, PUTDOUBLE, PUTVAR, PUTCAR, PUTFLOAT, PUTSTR, PUTCHR Tmax 4GL Programming Guide
PUTFLOAT Function PUTFLOAT(ByVal Fdlptr&, Field As String, idx As Long, ddata As Single) As Long FIELD(FDL) Field Single ddata idx. Fdlptr : FDL Field Idx Ddata Dim lsendbuf As Long Dim lret As Long Dim doubledata As Single lsendbuf = tpalloc("field ", "", 0) lret = PUTFLOAT(ByVal lsendbuf, "DOUBLEDATA", 0, doubledata) PUTINT, PUTLONG, PUTVAR, PUTCAR, PUTDOUBLE, PUTSTR, PUTCHR Tmax 4GL Programming Guide
PUTDOUBLE Function PUTDOUBLE(ByVal Fdlptr&, Field As String, idx As Long, ddata As Double) As Long FIELD(FDL) Field Double ddata idx. Fdlptr : FDL Field idx ddata Dim lsendbuf As Long Dim lret As Long Dim doubledata As Double lsendbuf = tpalloc("field ", "", 0) lret = PUTDOUBLE(ByVal lsendbuf, "DOUBLEDATA", 0, doubledata) PUTINT, PUTLONG, PUTVAR, PUTCAR, PUTFLOAT, PUTSTR, PUTCHR Tmax 4GL Programming Guide
PUTVAR Function PUTVAR(ByVal Fdlptr&, Field As String, idx As Long, text As String) As Long FIELD(FDL) Field String text idx. Fdlptr : FDL Field : idx : text : Dim lsendbuf As Long Dim lret As Long lsendbuf = tpalloc("field ", "", 0) lret = PUTVAR(ByVal lsendbuf, "INPUT", 0, txtinput.text) PUTINT, PUTLONG, PUTDOUBLE, PUTCAR, PUTFLOAT, PUTSTR, PUTCHR Tmax 4GL Programming Guide
PUTCAR_BA Function PUTCAR_BA(ByVal Fdlptr&, Field As String, idx As Long, ByteArray() As Byte, datalen As Long) As Long FIELD(FDL) Field Image ByteArray idx. Fdlptr : FDL Field : idx : ByteArray : datalen : ByteArray Dim isrc As Integer Dim lcopy As Long Dim lsize As Long Dim lbuffer() As Byte Dim datalen As Long lsendbuf = tpalloc("field", "", 102400) isrc = FreeFile Open ".\nmlogo.bmp" For Binary Access Read As isrc lsize = LOF(iSrc) datalen = lsize Do If lsize > MAX_BUFFER Then lsize = lsize - MAX_BUFFER lcopy = MAX_BUFFER Else lcopy = lsize End If ReDim lbuffer(lcopy - 1) Get isrc,, lbuffer Loop Until lcopy = lsize Close isrc lret = PUTCAR_BA(ByVal lsendbuf, "TP_BITMAP", 0, lbuffer, datalen) if lret < 0 then error processing Tmax 4GL Programming Guide
end if PUTINT, PUTLONG, PUTDOUBLE, PUTCAR, PUTVAR, PUTFLOAT, PUTSTR, PUTCHR Tmax 4GL Programming Guide
PUTSTR Function PUTSTR(ByVal strptr&, text As String) As Long STRING text. strptr : STRING text : Dim lsendbuf As Long Dim lret As Long Dim text As String lsendbuf = tpalloc("string", "", 1024) lret = PUTSTR(lsendbuf, text) PUTINT, PUTLONG, PUTDOUBLE, PUTVAR, PUTCAR, PUTFLOAT, PUTCHR Tmax 4GL Programming Guide
PUTCHR Function PUTCHR(ByVal Fdlptr&, ByVal Field As String, ByVal idx As Integer, ByRef data As String, ByVal datalen As Integer) As Integer Tmax fdl fbchg_tu() nth fldname value. value Char. Fbchg_tu() (nth) (value),. Fldptr : STRING Fieldt : Idx : Data : String datalen : String Dim lsendbuf As Long Dim lret As Long Dim chr As String lsendbuf = fballoc(10, 100) chr = a lret = PUTSTR(lsendbuf, CHR, 0, chr, 1 ) PUTINT, PUTLONG, PUTDOUBLE, PUTVAR, PUTCAR, PUTFLOAT, PUTSTR Tmax 4GL Programming Guide
PUTCAR Function PUTCAR(ByVal Carptr&, text As String, Datalen As Long) As Long CARRAY String text. Carptr : FDL Text : Datalen : Dim lsendbuf As Long Dim lret As Long Dim DataLen As Long lsendbuf = tpalloc("carray", "", 1024) 'CARRAY. DataLen = LenB(txtInput.text) lret = PUTCAR(ByVal lsendbuf, txtinput.text, DataLen) PUTINT, PUTLONG, PUTDOUBLE, PUTVAR, PUTFLOAT, PUTSTR, PUTCHR lstrcpy. ) Dim lsendbuf As Long Dim lret As Long lsendbuf = tpalloc("string", "", 1024) lret = lstrcpy(byval lsendbuf, ByVal txtinput.text) Tmax 4GL Programming Guide
GETINT Function GETINT(ByVal Fdlptr&, Field As String, idx As Long, idata As Integer) As Long FIELD(FDL) Field idxinteger idata. Fdlptr : FDL Field : idx : idata : Dim lsendbuf As Long Dim lret As Long Dim intdata As Integer lsendbuf = tpalloc("field ", "", 0) lret = GETINT(ByVal lsendbuf, "INTDATA", 0, intdata) GETLONG, GETDOUBLE, GETVAR, GETCAR, GETFLOAT, GETSTR, GETCHR Tmax 4GL Programming Guide
GETLONG Function GETLONG(ByVal Fdlptr&, Field As String, idx As Long, ldata As Long) As Long FIELD(FDL) Field idxlong ldata. Fdlptr : FDL Field : idx : ldata : Dim lsendbuf As Long Dim lret As Long Dim longdata As Long lsendbuf = tpalloc("field ", "", 0) lret = GETLONG(ByVal lsendbuf, "LONGDATA", 0, longdata) GETINT, GETDOUBLE, GETVAR, GETCAR, GETFLOAT, GETSTR, GETCHR Tmax 4GL Programming Guide
GETFLOAT Function GETFLOAT (ByVal Fdlptr&, Field As String, idx As Long, ddata As Single) As Long FIELD(FDL) Field idxsingle ddata. Fdlptr : FDL Field idx ddata Dim lsendbuf As Long Dim lret As Long Dim doubledata As Single lsendbuf = tpalloc("field ", "", 0) lret = GETFLOAT (ByVal lsendbuf, "DOUBLEDATA", 0, doubledata) Tmax 4GL Programming Guide
GETDOUBLE Function GETDOUBLE(ByVal Fdlptr&, Field As String, idx As Long, ddata As Double) As Long FIELD(FDL) Field idxdouble ddata. Fdlptr : FDL Field idx ddata Dim lsendbuf As Long Dim lret As Long Dim doubledata As Double lsendbuf = tpalloc("field ", "", 0) lret = GETDOUBLE(ByVal lsendbuf, "DOUBLEDATA", 0, doubledata) GETINT, GETLONG, GETVAR, GETCAR, GETFLOAT, GETSTR, GETCHR Tmax 4GL Programming Guide
GETVAR Function GETVAR(ByVal Fdlptr&, Field As String, idx As Long, text As String) As Long FIELD(FDL) Field idxstring text. Fdlptr : FDL Field : idx : text : Dim lsendbuf As Long Dim lret As Long lsendbuf = tpalloc("field ", "", 0) lret = GETVAR(ByVal lsendbuf, "INPUT", 0, txtoutput.text) GETINT, GETLONG, GETDOUBLE, GETCAR, GETFLOAT, GETSTR, GETCHR Tmax 4GL Programming Guide
GETCAR_BA Function GETCAR_BA (ByVal Fdlptr&, Field As String, idx As Long, ByRef ByteArray() As Byte, datalen As Long) As Long FIELD(FDL) Field idximage ByteArray. Fdlptr : FDL Field : idx : ByteArray : datalen : ByteArray Dim rbuffer(102400) As Byte Dim datalen As Long lrecvbuf = tpalloc("field", "", 102400) lret = PUTCAR_BA(ByVal lsendbuf, "TP_BITMAP", 0, lbuffer, datalen) if lret < 0 then error processing end if lret = tpcall(byval "FILEUP", ByVal lsendbuf, ByVal datalen&, lrecvbuf, lrbuflen, ByVal 0) lblcomment.caption = lblcomment.caption & " -> tpcall : " & lret If lret = -1 Then error processing end If lret = GETCAR_BA(ByVal lrecvbuf, "TP_BITMAP", 0, rbuffer, datalen) if lret < 0 then error processing end if GETINT, GETLONG, GETDOUBLE, GETCAR, GETVAR, GETFLOAT, GETSTR, GETCHR Tmax 4GL Programming Guide
GETSTR Function GETSTR(ByVal strptr&, text As String) As Long STRING text. strptr : STRING text : Dim lsendbuf As Long Dim lret As Long Dim text As String lsendbuf = fballoc(10, 100) Irecvbuf = fballoc(10, 100) lret = tpcall(byval SVC1, ByVal lsendbuf, ByVal DataLen&, lrecvbuf, lrbuflen, ByVal 0) lret = GETSTR(lrecvbuf, text) GETINT, GETLONG, GETDOUBLE, GETVAR, GETCAR, GETFLOAT, GETSTR, GETCHR Tmax 4GL Programming Guide
GETCHR Function GETCHR(ByVal Fdlptr&, ByVal Field As String, ByVal idx As Integer, ByRef data As String, ByVal datalen As Integer) As Integer Tmax fdl fbchg_tu() nth Field value. value Char. fbget_tu() (idx) (char).. Fldptr : STRING Field : Idx : Data : string datalen : string Dim lsendbuf As Long Dim lret As Long Dim chr As String lsendbuf = fballoc(10, 100) Irecvbuf = fballoc(10, 100) lret = tpcall(byval SVC1, ByVal lsendbuf, ByVal DataLen&, lrecvbuf, lrbuflen, ByVal 0) 'lret = GETSTR(lrecvbuf, CHR, 0, chr, 1 ) GETINT, GETLONG, GETDOUBLE, GETVAR, GETSTR, GETCAR, GETFLOAT Tmax 4GL Programming Guide
GETCAR Function GETCAR(ByVal Carptr&, text As String, Datalen As Long) As Long CARRAY String text. Carptr : FDL Text : Datalen : Dim lsendbuf As Long Dim lrecvbuf As Long Dim text As String Dim lret As Long Dim lrbuflen As Long lsendbuf = tpalloc("carray", "", 1024) lrecvbuf = tpalloc("carray", "", 1024) lret = tpcall(byval SVC1, ByVal lsendbuf, ByVal DataLen&, lrecvbuf, lrbuflen, ByVal 0) 'CARRAY. lret = GETCAR(lsendbuf, text, lrbuflen) GETINT, GETLONG, GETDOUBLE, GETVAR, GETSTR, GETFLOAT, GETSTR, GETCHR Tmax 4GL Programming Guide
TmaxError Sub TmaxError(StrErr As String) StrErr tperrno string error MsgBox. StrErr : Dim lsendbuf As Long Dim lrecvbuf As Long Dim lret As Long Dim lrbuflen As Long lsendbuf = tpalloc("carray", "", 1024) lrecvbuf = tpalloc("carray", "", 1024) lret = tpcall(byval "SVC1", ByVal lsendbuf, ByVal 0, lrecvbuf, lrbuflen, ByVal 0) If lret = -1 Then TmaxError ("tpcall (SVC1)") End If FdlErrorMsg Tmax 4GL Programming Guide
FdlErrorMsg Sub FdlErrorMsg(StrErr As String) StrErr fberrno MsgBox. StrErr : lret = fbput(byval lsendbuf, ByVal lfid, ByVal txtinput.text, ByVal 0) If lret = -1 Then FdlErrorMsg("fbput") error processing End If TmaxError Tmax 4GL Programming Guide
FilltpstartBuf Function FilltpstartBuf(sndbufp As Long, startinfop As tpstart_t) As Long Tmax tpstart_t. sndbufp : tpalloc startinfop : tpstart_t Dim lsndbuf As Integer Dim lret As Integer TmaxError Tmax 4GL Programming Guide
3. Visual Basic Sample, (EMP),,,.. TMAXDIR, IP.. : atmi.bas, fdl.bas, comm.bas, winapi.bas. *** VB *** EmployeeGrid.frm :. EmployeeGrid.frx EmployeeMgr.frm :Main.,,,. MSSCCPRJ.SCC QA_4GL.vbg QA_4GL_Sample.exe QA_4GL_Sample.vbp QA_4GL_Sample.vbw Atmi.bas comm.bas fdl.bas winapi.bas *** *** emp_c.mk : Makefile. emp_c.pc :. AIXOracle 9i. employee.m : Tmax *** *** demo.f : Field key bufferr. tmax. - Tmax : NULL - : FIELD KEY BUFFER fdlc fdl - : tpcall() Tmax 4GL Programming Guide
- : Tms AutoTransaction - : FDLSELECT, FDLINSERT, FDLDELETE, FDLUPDATE - : SVRGROUP EmployeeMgr EmployeeMgr Caption= LabelErr Caption= BtnExit BtnIns BtnDel BtnUdt BtnSel EditName EditEmpNo EditDept EditComm EditSal EditDate EditMgr EditJob Caption= Caption= Caption= Caption= Caption= < > Tmax 4GL Programming Guide
< > EmployeeMgr.frm Source Option Explicit Private Sub BtnDel_Click() Dim Isendbuf As Long Dim Irecvbuf As Long Dim Irbuflen As Long Dim Iret As Long Dim text As String Dim value As Long Dim dvalue As Double Dim svalue As Single Dim tx_b As Integer Dim txbool As Integer ' 1, 0 ' ' tpstart ' tmaxstart ' ' txbool = 0 If EditEmpNo.text = "" Then MsgBox "." Tmax 4GL Programming Guide
tmaxend Exit Sub End If value = Trim(EditEmpNo.text) ' ' Isendbuf = fballoc(100, 1024) If Isendbuf = Null Then TmaxError ("fballoc") Call fbfree(isendbuf) tmaxend Exit Sub End If ' ' Irecvbuf = fballoc(100, 1024) If Irecvbuf = Null Then TmaxError ("fballoc") Call fbfree(irecvbuf) tmaxend Exit Sub End If Iret = PUTLONG(ByVal Isendbuf, "EMPNO", 0, value) If Iret = -1 Then Call ExitSub(txbool, Isendbuf, Irecvbuf) End If ' ' Iret = tx_begin txbool = 1 If Iret < 0 Then Call ExitSub(txbool, Isendbuf, Irecvbuf) End If ' ' Iret = tpcall(byval "FDLDELETE", ByVal Isendbuf, ByVal 0, Irecvbuf, Irbuflen, ByVal 0) LabelErr.Caption = "sbuf = " & Isendbuf & ", rbuf = " & Irecvbuf If Iret = -1 Then TmaxError ("tpcall(svc1)") ViewErr (Irecvbuf) Call ExitSub(txbool, Isendbuf, Irecvbuf) Tmax 4GL Programming Guide
End If ' ' Iret = tx_commit If Iret < 0 Then Call ExitSub(txbool, Isendbuf, Irecvbuf) Else txbool = 1 Call ExitSub(txbool, Isendbuf, Irecvbuf) End If End Sub Private Sub BtnExit_Click() End End Sub Private Sub BtnIns_Click() Dim Isendbuf As Long Dim Irecvbuf As Long Dim Irbuflen As Long Dim Iret As Long Dim text As String Dim value As Long Dim dvalue As Double Dim svalue As Single Dim lenl As Long Dim txbool As Integer ' 1, 0 ' ' tpstart ' tmaxstart ' ' txbool = 0 If EditEmpNo.text = "" Then MsgBox "." tmaxend Exit Sub End If ' ' Isendbuf = fballoc(100, 1024) If Isendbuf = Null Then TmaxError ("fballoc") Call fbfree(isendbuf) Tmax 4GL Programming Guide
tmaxend Exit Sub End If ' ' Irecvbuf = fballoc(100, 1024) If Irecvbuf = Null Then TmaxError ("fballoc") Call fbfree(irecvbuf) tmaxend Exit Sub End If Iret = PUTLONG(ByVal Isendbuf, "EMPNO", 0, Trim(EditEmpNo.text)) If Iret = -1 Then Call ExitSub(txbool, Isendbuf, Irecvbuf) End If Iret = PUTVAR(ByVal Isendbuf, "ENAME", 0, Trim(EditName.text)) If Iret = -1 Then Call ExitSub(txbool, Isendbuf, Irecvbuf) End If Iret = PUTVAR(ByVal Isendbuf, "JOB", 0, Trim(EditJob.text)) If Iret = -1 Then Call ExitSub(txbool, Isendbuf, Irecvbuf) End If Iret = PUTLONG(ByVal Isendbuf, "MGR", 0, Trim(EditMgr.text)) If Iret = -1 Then ' ' Call ExitSub(txbool, Isendbuf, Irecvbuf) End If Iret = PUTVAR(ByVal Isendbuf, "DATE", 0, Trim(EditDate.text)) If Iret = -1 Then Call ExitSub(txbool, Isendbuf, Irecvbuf) End If svalue = Trim(EditSal.text) ' fbput, fbget_fldkey comm.bas. ' ' fbget_fldkey. ' Iret = fbput(byval Isendbuf, ByVal fbget_fldkey("sal"), svalue, ByVal lenl) If Iret = -1 Then Call ExitSub(txbool, Isendbuf, Irecvbuf) End If '. ' Tmax 4GL Programming Guide
'svalue = Trim(EditComm.text) 'Iret = fbput(byval Isendbuf, ByVal fbget_fldkey("comm"), svalue, ByVal lenl) 'If Iret = -1 Then ' FdlErrorMsg ("fbput") ' Exit Sub 'End If '. ' Iret = PUTFLOAT(ByVal Isendbuf, "COMM", 0, Trim(EditComm.text)) If Iret = -1 Then Call ExitSub(txbool, Isendbuf, Irecvbuf) End If Iret = PUTLONG(ByVal Isendbuf, "DEPTNO", 0, Trim(EditDept.text)) If Iret = -1 Then Call ExitSub(txbool, Isendbuf, Irecvbuf) End If ' ' Iret = tx_begin txbool = 1 If Iret < 0 Then Call ExitSub(txbool, Isendbuf, Irecvbuf) End If ' ' Iret = tpcall(byval "FDLINSERT", ByVal Isendbuf, ByVal 0, Irecvbuf, Irbuflen, ByVal 0) LabelErr.Caption = "sbuf = " & Isendbuf & ", rbuf = " & Irecvbuf If Iret = -1 Then TmaxError ("tpcall(svc1)") ViewErr (Irecvbuf) Call ExitSub(txbool, Isendbuf, Irecvbuf) End If ' ' Iret = tx_commit If Iret < 0 Then Call ExitSub(txbool, Isendbuf, Irecvbuf) Else txbool = 1 Call ExitSub(txbool, Isendbuf, Irecvbuf) End If Tmax 4GL Programming Guide
End Sub ' ' ' ' Private Sub BtnSel_Click() Hide ' ' EmployeeGrid.Show End Sub ' ' Private Sub BtnUdt_Click() Dim Isendbuf As Long Dim Irecvbuf As Long Dim Irbuflen As Long Dim Iret As Long Dim text As String Dim value As Long Dim dvalue As Double Dim svalue As Single Dim lenl As Long Dim txbool As Integer ' 1, 0 ' ' tpstart ' tmaxstart ' ' txbool = 0 If EditEmpNo.text = "" Then MsgBox "." tmaxend Exit Sub End If ' ' Isendbuf = fballoc(100, 1024) If Isendbuf = Null Then TmaxError ("fballoc") Call fbfree(isendbuf) tmaxend Exit Sub End If ' ' Irecvbuf = fballoc(100, 1024) Tmax 4GL Programming Guide
If Irecvbuf = Null Then TmaxError ("fballoc") Call fbfree(irecvbuf) tmaxend Exit Sub End If Iret = PUTLONG(ByVal Isendbuf, "EMPNO", 0, Trim(EditEmpNo.text)) If Iret = -1 Then Call ExitSub(txbool, Isendbuf, Irecvbuf) End If Iret = PUTVAR(ByVal Isendbuf, "ENAME", 0, Trim(EditName.text)) If Iret = -1 Then Call ExitSub(txbool, Isendbuf, Irecvbuf) End If Iret = PUTVAR(ByVal Isendbuf, "JOB", 0, Trim(EditJob.text)) If Iret = -1 Then Call ExitSub(txbool, Isendbuf, Irecvbuf) End If Iret = PUTLONG(ByVal Isendbuf, "MGR", 0, Trim(EditMgr.text)) If Iret = -1 Then Call ExitSub(txbool, Isendbuf, Irecvbuf) End If Iret = PUTVAR(ByVal Isendbuf, "DATE", 0, Trim(EditDate.text)) If Iret = -1 Then Call ExitSub(txbool, Isendbuf, Irecvbuf) End If svalue = Trim(EditSal.text) ' Declare Function fbput Lib "TMAX4GL.DLL" (ByVal pfbuf As Long, ByVal fieldid As Long, pbuffer As Any, ByVal Fieldlen As Long) As Long Iret = fbput(byval Isendbuf, ByVal fbget_fldkey("sal"), svalue, ByVal lenl) If Iret = -1 Then Call ExitSub(txbool, Isendbuf, Irecvbuf) End If svalue = Trim(EditComm.text) Iret = fbput(byval Isendbuf, ByVal fbget_fldkey("comm"), svalue, ByVal lenl) If Iret = -1 Then Call ExitSub(txbool, Isendbuf, Irecvbuf) End If Tmax 4GL Programming Guide
Iret = PUTLONG(ByVal Isendbuf, "DEPTNO", 0, Trim(EditDept.text)) If Iret = -1 Then Call ExitSub(txbool, Isendbuf, Irecvbuf) End If ' ' Iret = tx_begin txbool = 1 If Iret < 0 Then Call ExitSub(txbool, Isendbuf, Irecvbuf) End If ' ' Iret = tpcall(byval "FDLUPDATE", ByVal Isendbuf, ByVal 0, Irecvbuf, Irbuflen, ByVal 0) LabelErr.Caption = "sbuf = " & Isendbuf & ", rbuf = " & Irecvbuf If Iret = -1 Then TmaxError ("tpcall(svc1)") ViewErr (Irecvbuf) Call ExitSub(txbool, Isendbuf, Irecvbuf) End If ' ' Iret = tx_commit If Iret < 0 Then Call ExitSub(txbool, Isendbuf, Irecvbuf) Else txbool = 1 Call ExitSub(txbool, Isendbuf, Irecvbuf) End If End Sub Private Sub ExitSub(txbool As Integer, Isendbuf As Long, Irecvbuf As Long) If txbool = 1 Then tx_rollback End If ' ' Call fbfree(byval Isendbuf&) Call fbfree(byval Irecvbuf&) ' tpend ' tmaxend Tmax 4GL Programming Guide
Exit Sub End Sub ' tpstart ' Private Sub tmaxstart() Dim ret As Integer '. ' ' atmi.bas. ' ' Declare Function tmaxreadenv Lib "TMAX4GL.DLL" (ByVal envfile As String, ByVal label As String) As Long ' ' Tmax Reference Manual. ' ret = tmaxreadenv("c:\tmax.env", "aix5l389") If ret < 0 Then TmaxError ("tmaxreadenv") Exit Sub End If ret = tpstart(byval 0&) If ret = -1 Then LabelErr.Caption = "tpstart error = " & gettperrno() TmaxError ("tpstart") Exit Sub Else LabelErr.Caption = "tpstart return value = " & ret & " tpstart success" End If End Sub ' tpend ' Private Sub tmaxend() Dim ret As Integer ret = tpend() If ret = -1 Then LabelErr.Caption = "tpend error = " & gettperrno() TmaxError ("tpend") Exit Sub Else LabelErr.Caption = "tpreturn return value = " & ret End If End Sub Tmax 4GL Programming Guide
< > ' ' Private Sub ViewErr(ByVal a As Long) 'E_TYPE 9009 long - - 'E_CODE 9010 long - - 'E_MSG 9011 string - - 'E_TMP 9012 long - - Dim typel, codel, tmpl As Long Dim msgs As String Dim Iret As Integer ' Tmax FDL Reference Manual ' ' comm.bas ' Iret = fbget_tu(byval a, ByVal fbget_fldkey("e_type"), 0, typel, 0) If Iret = -1 Then FdlErrorMsg ("fbget_tu") Exit Sub End If Iret = fbget_tu(byval a, ByVal fbget_fldkey("e_code"), 0, codel, 0) If Iret = -1 Then FdlErrorMsg ("fbget_tu") Exit Sub End If Iret = GETVAR(ByVal a, "E_MSG", 0, msgs) If Iret = -1 Then TmaxError ("ViewErr, GETVAR, E_MSG") Exit Sub End If Iret = fbget_tu(byval a, ByVal fbget_fldkey("e_tmp"), 0, tmpl, 0) If Iret = -1 Then FdlErrorMsg ("fbget_tu") Exit Sub End If ' ' Tmax 4GL Programming Guide
MsgBox ("Error Type : " & typel & ",Code : " & codel & ",Message : " & msgs & ",Tmp : " & tmpl) End Sub Tmax 4GL Programming Guide
EmployeeGrid EmployeeGrid Caption= InfoText MultiLine=True BtnReturn Caption= < > < > EmployeeGrid.frm Source LabelErr Option Explicit ' ' Private Sub BtnReturn_Click() Hide EmployeeMgr.Show End Sub ' Click ' Private Sub Form_Activate() Dim Isendbuf As Long Tmax 4GL Programming Guide
Dim Irecvbuf As Long Dim Irbuflen As Long Dim Iret As Integer Dim text As String Dim value As Long Dim dvalue As Double Dim svalue As Single Dim lenl As Long Dim inits, outputs As String Dim empnos, enames, jobs, mgrs, dates, sals, comms, deptnos As String Dim cntl As Long Dim eno As Long Dim txbool As Integer ' 1, 0 ' ' tpstart ' tmaxstart ' ' txbool = 0 inits = vbcrlf & vbtab & vbtab & vbtab & "***** *****" & vbcrlf & vbtab & "=========================================================" & vbcrlf & vbtab & " COMM " & vbcrlf & vbtab & "=========================================================" & vbcrlf & vbcrlf If EmployeeMgr.EditEmpNo.text = "" Then MsgBox "." Hide EmployeeMgr.Show Exit Sub End If ' ' Isendbuf = fballoc(100, 1024) If Isendbuf = Null Then TmaxError ("fballoc") Call fbfree(isendbuf) tmaxend Exit Sub End If ' ' Irecvbuf = fballoc(100, 1024) If Irecvbuf = Null Then Tmax 4GL Programming Guide
TmaxError ("fballoc") Call fbfree(irecvbuf) tmaxend Exit Sub End If '. eno = Trim(EmployeeMgr.EditEmpNo.text) Iret = fbput(byval Isendbuf, ByVal fbget_fldkey("empno"), eno, ByVal lenl) If Iret = -1 Then Call ExitSub(txbool, Isendbuf, Irecvbuf) End If ' ' Iret = tpcall(byval "FDLSELECT", ByVal Isendbuf, ByVal 0, Irecvbuf, Irbuflen, ByVal 0) If Iret = -1 Then ViewErr (Irecvbuf) Call ExitSub(txbool, Isendbuf, Irecvbuf) End If cntl = fbkeyoccur(byval Irecvbuf, ByVal fbget_fldkey("empno")) Dim i As Long For i = 0 To cntl - 1 Iret = GETLONG(ByVal Irecvbuf, "EMPNO", i, value) If Iret = -1 Then TmaxError ("GETLONG(EMPNO)") Call ExitSub(txbool, Isendbuf, Irecvbuf) End If empnos = value Iret = GETVAR(ByVal Irecvbuf, "ENAME", i, text) If Iret = -1 Then TmaxError ("GETVAR(ENAME)") Call ExitSub(txbool, Isendbuf, Irecvbuf) End If enames = text Iret = GETVAR(ByVal Irecvbuf, "JOB", i, text) If Iret = -1 Then TmaxError ("GETVAR(JOB)") Call ExitSub(txbool, Isendbuf, Irecvbuf) End If jobs = text Tmax 4GL Programming Guide
Iret = GETLONG(ByVal Irecvbuf, "MGR", i, value) If Iret = -1 Then TmaxError ("GETLONG(MGR)") Call ExitSub(txbool, Isendbuf, Irecvbuf) End If mgrs = value Iret = GETVAR(ByVal Irecvbuf, "DATE", i, text) If Iret = -1 Then TmaxError ("GETVAR(DATE)") Call ExitSub(txbool, Isendbuf, Irecvbuf) End If dates = text ' SAL float. ' ' comm.bas. ' Iret = fbget_tu(byval Irecvbuf, ByVal fbget_fldkey("sal"), i, svalue, 0) If Iret = -1 Then FdlErrorMsg ("fbget_tu") Call ExitSub(txbool, Isendbuf, Irecvbuf) End If sals = svalue Iret = GETFLOAT(ByVal Irecvbuf, "COMM", i, svalue) If Iret = -1 Then TmaxError ("GETFLOAT(COMM)") Call ExitSub(txbool, Isendbuf, Irecvbuf) End If comms = svalue Iret = GETLONG(ByVal Irecvbuf, "DEPTNO", i, value) If Iret = -1 Then TmaxError ("GETLONG(DEPTNO)") Call ExitSub(txbool, Isendbuf, Irecvbuf) End If deptnos = value & vbcrlf outputs = outputs & " " & empnos & vbtab & enames & vbtab & jobs & vbtab & mgrs & vbtab & dates & vbtab & sals & vbtab & comms & vbtab & deptnos Next i InfoText.text = inits & outputs ' ' LabelErr.Caption = "SAL = " & dvalue Tmax 4GL Programming Guide
Call ExitSub(txbool, Isendbuf, Irecvbuf) End Sub Private Sub ExitSub(txbool As Integer, Isendbuf As Long, Irecvbuf As Long) If txbool = 1 Then tx_rollback End If ' ' Call fbfree(byval Isendbuf&) Call fbfree(byval Irecvbuf&) ' tpend ' tmaxend Exit Sub End Sub ' tpstart ' Private Sub tmaxstart() Dim ret As Integer '. ' ' atmi.bas. ' ' Declare Function tmaxreadenv Lib "TMAX4GL.DLL" (ByVal envfile As String, ByVal label As String) As Long ' ' Tmax Reference Manual. ' ret = tmaxreadenv("c:\tmax.env", "aix5l389") If ret < 0 Then TmaxError ("tmaxreadenv") Exit Sub End If ret = tpstart(byval 0&) If ret = -1 Then LabelErr.Caption = "tpstart error = " & gettperrno() TmaxError ("tpstart") Exit Sub Else LabelErr.Caption = "tpstart return value = " & ret & " tpstart success" End If End Sub ' tpend ' Tmax 4GL Programming Guide
Private Sub tmaxend() Dim ret As Integer ret = tpend() If ret = -1 Then LabelErr.Caption = "tpend error = " & gettperrno() TmaxError ("tpend") Exit Sub Else LabelErr.Caption = "tpreturn return value = " & ret End If End Sub ' ' Private Sub ViewErr(ByVal a As Long) 'E_TYPE 9009 long - - 'E_CODE 9010 long - - 'E_MSG 9011 string - - 'E_TMP 9012 long - - Dim typel As Long Dim codel As Long Dim msgs As String Dim tmpl As Long Dim Iret As Integer Iret = fbget_tu(byval a, ByVal fbget_fldkey("e_type"), 0, typel, 0) If Iret = -1 Then FdlErrorMsg ("fbget_tu") Exit Sub End If Iret = fbget_tu(byval a, ByVal fbget_fldkey("e_code"), 0, codel, 0) If Iret = -1 Then FdlErrorMsg ("fbget_tu") Exit Sub End If Iret = GETVAR(ByVal a, "E_MSG", 0, msgs) Iret = fbget_tu(byval a, ByVal fbget_fldkey("e_tmp"), 0, tmpl, 0) If Iret = -1 Then FdlErrorMsg ("fbget_tu") Exit Sub End If MsgBox ("Error Type : " & typel & ",Code : " & codel & ",Message : " & msgs & ",Tmp : " & tmpl) Tmax 4GL Programming Guide
End Sub demo.f DataBase EMP Table EMPNO NUMBER NOT NULL P1 ENAME VARCHAR(16) JOB VARCHAR(16) MGR NUMBER HIREDATE DATE SAL NUMBER(7,2) COMM NUMBER(7,2) DEPTNO NUMBER Tmax 4GL Programming Guide
emp_c.pc Tmax 4GL Programming Guide
Tmax 4GL Programming Guide
Tmax 4GL Programming Guide
Tmax 4GL Programming Guide
Tmax 4GL Programming Guide
Tmax 4GL Programming Guide
} Tmax 4GL Programming Guide
emp_c.mk Tmax 4GL Programming Guide
tmconfig.m *DOMAIN dom1 *NODE tmax1 *SVRGROUP svg1 *SERVER emp_c *SERVICE FDLSELECT FDLUPDATE FDLDELETE FDLINSERT SHMKEY=70000, MAXUSER=200, MINCLH=1, MAXCLH=5, TPORTNO=8888, BLOCKTIME=200, TXTIME=200 TMAXDIR="/home/tmax", APPDIR="/home/tmax/appbin", PATHDIR="/home/tmax/path", TLOGDIR= "/home/tmax/log/tlog", SLOGDIR="/home/tmax/log/slog" ULOGDIR="/home/tmax/log/ulog" NODENAME=tmax1, DBNAME=ORACLE, OPENINFO="ORACLE_XA+Acc=P/scott/tiger+SesTm=60", TMSNAME = svg1_tms SVGNAME=svg1, MIN=1 SVRNAME= emp_c SVRNAME= emp_c SVRNAME= emp_c SVRNAME= emp_c Tmax 4GL Programming Guide
III. Delphi Tmax 4GL Programming Guide
1.,.. C.. atmi Tmax Reference ManualTmax Programing Guide.. atmi.pas fdl.pas : atmi : Tmax 4GL Programming Guide
2. Delphi Sample,. tpstart TPSTART_T Tmax Tmax. : atmi.pas, fdl.pas, TuxSvc.pas. *** *** Atmi.dcu Atmi.pas EmployeeMgr.bpg EmployeeMgr.cfg EmployeeMgr.dof EmployeeMgr.dpr EmployeeMgr.exe EmployeeMgr.res Fdl.dcu Fdl.pas TuxSvc.pas main.dcu main.dfm main.pas : client. *** *** emp_c.mk : Makefile. emp_c.pc :. AIXOracle 9i. employee.m : Tmax *** *** demo.f : Field key bufferr. tmax. - Tmax : Tmax - : FIELD KEY BUFFER fdlc fdl - : tpcall() - : Tms AutoTransaction Tmax 4GL Programming Guide
- : FDLSELECT, FDLDELETE, FDLUPDATE, FDLINSERT - : SVRGROUP EmployeeMgrForm EmployeeMgrForm Caption= LabelErr TLabel Caption= BtnExit TButton Caption= BtnIns TButton Caption= BtnDel TButton Caption= BtnUdt TButton Caption= BtnSel TButton Caption= EditName EditEmpNo EditDept EditComm EditSal EditDate EditMgr EditJob MList BtnReturn TEdit TEdit TEdit TEdit TEdit TEdit TEdit TEdit TMemo TButton < > Tmax 4GL Programming Guide
< > main.pas Source unit main; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TEmployeeMgrForm = class(tform) LabelEmpNo: TLabel; LabelName: TLabel; EditEmpNo: TEdit; EditName: TEdit; GroupBoxInfo: TGroupBox; LabelJob: TLabel; LabelMgr: TLabel; LabelDate: TLabel; LabelSal: TLabel; EditJob: TEdit; EditMgr: TEdit; EditDate: TEdit; EditSal: TEdit; EditComm: TEdit; Tmax 4GL Programming Guide
EditDept: TEdit; LabelComm: TLabel; LabelDept: TLabel; BtnSel: TButton; BtnUdt: TButton; BtnDel: TButton; BtnIns: TButton; BtnExit: TButton; LabelErr: TLabel; MList: TMemo; BtnReturn: TButton; procedure BtnExitClick(Sender: TObject); procedure BtnSelClick(Sender: TObject); procedure BtnUdtClick(Sender: TObject); procedure BtnDelClick(Sender: TObject); procedure BtnInsClick(Sender: TObject); procedure tmaxstart(); procedure BtnReturnClick(Sender: TObject); procedure ViewErr( a:pointer ); { Private declarations } public { Public declarations } end; var EmployeeMgrForm: TEmployeeMgrForm; implementation // Atmi, Fdl uses Atmi, Fdl; const BufferSize = 1024; {$R *.DFM} // String {$H+} procedure TEmployeeMgrForm.tmaxStart(); var tpinfo: ptpstart; ret: integer; begin // atmi.pas. Tmax 4GL Programming Guide
// Function tmaxreadenv(a:pchar; b:pchar):integer; cdecl; external TmaxDLL; // Tmax Reference Manual. ret := tmaxreadenv('c:\tmax.env', 'aix5l389'); if ret < 0 then begin ShowMessage('tmaxreadenv Error'); Exit; end; // tpstart tpinfo := tpalloc('tpstart', NIL, 0); if tpinfo = Nil then begin ShowMessage('tpinfo tpalloc failed,' + StrPas(tpstrerror(gettperrno))); tpfree(tpinfo); Exit; end; // //. // // // tpinfo.usrname := 'tmax'; // // tpinfo.cltname := 'tmax'; // // tpinfo.flags := TPUNSOL_POLL; // Tmax ret := tpstart(tpinfo); if ret < 0 then begin ShowMessage('tpstart failed' + StrPas(tpstrerror(gettperrno))); tpfree(tpinfo); tpend(); Exit; end; // tpfree(tpinfo); end; //. procedure TEmployeeMgrForm.BtnExitClick(Sender: TObject); begin tpend(); close; end; Tmax 4GL Programming Guide
procedure TEmployeeMgrForm.BtnUdtClick(Sender: TObject); var sndbuf, revbuf: Pointer; ret, empno_l, mgr_l, deptno_l: longint; sal_f, comm_f: single; job_s, ename_s: pointer; rlen: integer; date_s: string[100]; begin tmaxstart(); // sndbuf := fballoc(1000, 10000); if sndbuf = Nil then begin ShowMessage('sndbuf tpalloc failed, ' + StrPas(tpstrerror(gettperrno))); fbfree(sndbuf); tpend(); Exit; end; // revbuf := fballoc(1000, 10000); if revbuf = Nil then begin ShowMessage('revbuf tpalloc failed, ' + StrPas(tpstrerror(gettperrno))); fbfree(revbuf); tpend(); Exit; end; empno_l := StrToInt(EditEmpNo.text); fbput(sndbuf, fbget_fldkey('empno'), @empno_l, 0); ename_s := PChar(EditName.text); fbput(sndbuf, fbget_fldkey('ename'), ename_s, 0); job_s := PChar(EditJob.text); fbput(sndbuf, fbget_fldkey('job'), job_s, 0); mgr_l := StrToInt(EditMgr.text); fbput(sndbuf, fbget_fldkey('mgr'), @mgr_l, 0); // date_s := PChar(EditDate.text); // fbput(sndbuf, fbget_fldkey('date'), @date_s, 0); date_s := EditDate.text; Tmax 4GL Programming Guide
rlen := length(editdate.text); ret := fbchg_tu(sndbuf, fbget_fldkey('date'),0,@date_s[1], 0); if ret = -1 then begin LabelErr.Caption := LabelErr.Caption + 'DATE error!!!'; Exit; end; sal_f := StrToFloat(EditSal.text); fbput(sndbuf, fbget_fldkey('sal'), @sal_f, 0); comm_f := StrToFloat(EditComm.text); fbput(sndbuf, fbget_fldkey('comm'), @comm_f, 0); deptno_l := StrToInt(EditDept.text); fbput(sndbuf, fbget_fldkey('deptno'), @deptno_l, 0); // ret := tx_begin(); if ret = -1 then begin LabelErr.Caption := LabelErr.Caption + 'tx_begin error'; Exit; end; // ret := tpcall('fdlupdate', sndbuf, 0, @revbuf, @rlen, 0); if ret < 0 then begin ViewErr(revbuf); tx_rollback(); fbfree(sndbuf); fbfree(revbuf); tpend(); Exit; end; ret := tx_commit(); if ret < 0 then begin ShowMessage('tx_commit failed! ' + StrPas(tpstrerror(gettperrno))); tx_rollback(); fbfree(sndbuf); fbfree(revbuf); tpend(); Exit; end; // fbfree(sndbuf); Tmax 4GL Programming Guide
fbfree(revbuf); tpend(); end; procedure TEmployeeMgrForm.BtnDelClick(Sender: TObject); var sndbuf, revbuf: Pointer; empno_l, ret: longint; rlen: integer; begin tmaxstart(); // sndbuf := fballoc(1000, 10000); if sndbuf = Nil then begin ShowMessage('sndbuf tpalloc failed, ' + StrPas(tpstrerror(gettperrno))); tpend(); Exit; end; // revbuf := fballoc(1000, 10000); if sndbuf = Nil then begin ShowMessage('sndbuf tpalloc failed, ' + StrPas(tpstrerror(gettperrno))); tpend(); Exit; end; empno_l := StrToInt(EditEmpNo.text); fbput(sndbuf, fbget_fldkey('empno'), @empno_l, 0); // ret := tx_begin(); if ret = -1 then begin LabelErr.Caption := LabelErr.Caption + 'tx_begin error'; Exit; end; // ret := tpcall('fdldelete', sndbuf, 0, @revbuf, @rlen, 0); if ret < 0 then begin ViewErr(revbuf); tx_rollback(); fbfree(sndbuf); fbfree(revbuf); tpend(); Tmax 4GL Programming Guide
Exit; end; ret := tx_commit(); if ret < 0 then begin ViewErr(revbuf); tx_rollback(); fbfree(sndbuf); fbfree(revbuf); tpend(); Exit; end; // fbfree(sndbuf); fbfree(revbuf); tpend(); end; procedure TEmployeeMgrForm.BtnInsClick(Sender: TObject); var sndbuf, revbuf: Pointer; empno_l, mgr_l, deptno_l: longint; sal_f, comm_f: single; job_s, ename_s, date_s: string[100]; ret, rlen: integer; begin // tpstart tmaxstart(); // LabelErr.Caption := ''; sndbuf := fballoc(1000,10000); if sndbuf = Nil then begin LabelErr.Caption := 'sndbuf tpalloc failed, ' + StrPas(tpstrerror(gettperrno)); fbfree(sndbuf); tpend(); Exit; end; revbuf := fballoc(100,1000); if revbuf = Nil then begin LabelErr.Caption := 'revbuf tpalloc failed, ' + StrPas(tpstrerror(gettperrno)); fbfree(revbuf); tpend(); Exit; Tmax 4GL Programming Guide
end; empno_l := StrToInt(EditEmpNo.text); ret := fbput(sndbuf, fbget_fldkey('empno'), @empno_l, 0); if ret = -1 then begin LabelErr.Caption := 'EMPNO error!!!'; Exit; end; ename_s := EditName.text; rlen := length(editname.text); ret := fbchg_tu(sndbuf, fbget_fldkey('ename'),0,@ename_s[1], 0); if ret = -1 then begin LabelErr.Caption := LabelErr.Caption + 'ENAME error!!!'; Exit; end; job_s := EditJob.text; rlen := length(editjob.text); ret := fbchg_tu(sndbuf, fbget_fldkey('job'),0,@job_s[1], 0); if ret = -1 then begin LabelErr.Caption := LabelErr.Caption + 'JOB error!!!'; Exit; end; mgr_l := StrToInt(EditMgr.text); ret := fbput(sndbuf, fbget_fldkey('mgr'), @mgr_l, 0); if ret = -1 then begin LabelErr.Caption := LabelErr.Caption + 'MGR error!!!'; Exit; end; date_s := EditDate.text; rlen := length(editdate.text); ret := fbchg_tu(sndbuf, fbget_fldkey('date'),0,@date_s[1], 0); if ret = -1 then begin LabelErr.Caption := LabelErr.Caption + 'DATE error!!!'; Exit; end; sal_f := StrToFloat(EditSal.text); ret := fbput(sndbuf, fbget_fldkey('sal'), @sal_f, 0); if ret = -1 then begin LabelErr.Caption := LabelErr.Caption + 'SAL error!!!'; Exit; end; Tmax 4GL Programming Guide
comm_f := StrToFloat(EditComm.text); ret := fbput(sndbuf, fbget_fldkey('comm'), @comm_f, 0); if ret = -1 then begin LabelErr.Caption := LabelErr.Caption + 'COMM error!!!'; Exit; end; deptno_l := StrToInt(EditDept.text); ret := fbput(sndbuf, fbget_fldkey('deptno'), @deptno_l, 0); if ret = -1 then begin LabelErr.Caption := LabelErr.Caption + 'DEPTNO error!!!'; Exit; end; // ret := tx_begin(); if ret = -1 then begin LabelErr.Caption := LabelErr.Caption + 'tx_begin error'; Exit; end; // ret := tpcall('fdlinsert', sndbuf, 0, @revbuf, @rlen, 0); if ret < 0 then begin ViewErr(revbuf); tx_rollback(); fbfree(sndbuf); fbfree(revbuf); tpend(); Exit; end; ret := tx_commit(); if ret < 0 then begin ViewErr(revbuf); tx_rollback(); fbfree(sndbuf); fbfree(revbuf); tpend(); Exit; end; // fbfree(revbuf); fbfree(sndbuf); tpend(); Tmax 4GL Programming Guide
end; procedure TEmployeeMgrForm.BtnReturnClick(Sender: TObject); begin BtnReturn.Visible := false; MList.Visible := false; end; procedure TEmployeeMgrForm.ViewErr( a:pointer ); var types: PChar; codes: PChar; msgs: PChar; tmps: PChar; // Iret: Integer; begin // E_TYPE 9009 long - - // E_CODE 9010 long - - // E_MSG 9011 string - - // E_TMP 9012 long - - types := fbgetvals(a, fbget_fldkey('e_type'), 0); codes := fbgetvals(a, fbget_fldkey('e_code'), 0); msgs := fbgetvals(a, fbget_fldkey('e_msg'), 0); tmps := fbgetvals(a, fbget_fldkey('e_tmp'), 0); ShowMessage('Error Type : ' + types + ',Code : ' + codes + ',Message : ' + msgs + ',Tmp : ' + tmps); end; Tmax 4GL Programming Guide
//. procedure TEmployeeMgrForm.BtnSelClick(Sender: TObject); var sndbuf, revbuf: Pointer; empno_l, ret: longint; rlen: integer; varf: single; cnt_i, i: integer; empno_s, name_s, job_s, mgr_s, date_s, sal_s, comm_s, dept_s: string; output_s: string; init_s: string; begin // MList.Visible := true; BtnReturn.Visible := true; tmaxstart(); // sndbuf := fballoc(100,1000); if sndbuf = Nil then begin ShowMessage('sndbuf tpalloc failed, ' + StrPas(tpstrerror(gettperrno))); fbfree(sndbuf); Tmax 4GL Programming Guide
tpend(); Exit; end; // revbuf := fballoc(100,1000); if revbuf = Nil then begin ShowMessage('revbuf tpalloc failed, ' + StrPas(tpstrerror(gettperrno))); fbfree(revbuf); tpend(); Exit; end; empno_l := StrToInt(EditEmpNo.text); fbput(sndbuf, fbget_fldkey('empno'), @empno_l, 0); // ret := tpcall('fdlselect', sndbuf, 0, @revbuf, @rlen, 0); if ret < 0 then begin ViewErr(revbuf); fbfree(sndbuf); fbfree(revbuf); init_s := #10#13#9#9#9'*********** ***********'#10#9'================================================== ==========='#10#9' COMM '#10#9'========================================================== ==='#10; output_s := init_s + ' '; MList.Lines.Text := output_s; tpend(); Exit; end; cnt_i := fbkeyoccur(revbuf, fbget_fldkey('empno')); for i := 0 to cnt_i -1 do begin empno_s := fbgetvals(revbuf, fbget_fldkey('empno'),i); name_s := fbgetvals(revbuf, fbget_fldkey('ename'),i); job_s := fbgetvals(revbuf, fbget_fldkey('job'),i); mgr_s := fbgetvals(revbuf, fbget_fldkey('mgr'),i); date_s := fbgetvals(revbuf, fbget_fldkey('date'),i); sal_s := fbgetvals(revbuf, fbget_fldkey('sal'),i); comm_s := fbgetvals(revbuf, fbget_fldkey('comm'),i); dept_s := fbgetvals(revbuf, fbget_fldkey('deptno'),i); output_s := output_s + ' ' + empno_s + #9 + name_s + #9 + job_s + Tmax 4GL Programming Guide
#9 + mgr_s + #9 + date_s + #9 + sal_s + #9 + comm_s + #9 + dept_s + #10 ; end; init_s := #10#13#9#9#9'*********** ***********'#10#9'================================================== ==========='#10#9' COMM '#10#9'========================================================== ==='#10; output_s := init_s + output_s; MList.Lines.Text := output_s; // fbfree(sndbuf); fbfree(revbuf); tpend(); end; Tmax 4GL Programming Guide
procedure TEmployeeMgrForm.ViewErr( a:pointer ); var types: PChar; codes: PChar; msgs: PChar; tmps: PChar; // Iret: Integer; begin // E_TYPE 9009 long - - // E_CODE 9010 long - - // E_MSG 9011 string - - // E_TMP 9012 long - - types := fbgetvals(a, fbget_fldkey('e_type'), 0); codes := fbgetvals(a, fbget_fldkey('e_code'), 0); msgs := fbgetvals(a, fbget_fldkey('e_msg'), 0); tmps := fbgetvals(a, fbget_fldkey('e_tmp'), 0); ShowMessage('Error Type : ' + types + ',Code : ' + codes + ',Message : ' + msgs + ',Tmp : ' + tmps); end; Tmax 4GL Programming Guide
demo.f DataBase EMP Table EMPNO NUMBER NOT NULL P1 ENAME VARCHAR(16) JOB VARCHAR(16) MGR NUMBER HIREDATE DATE SAL NUMBER(7,2) COMM NUMBER(7,2) DEPTNO NUMBER Tmax 4GL Programming Guide
emp_c.pc Tmax 4GL Programming Guide
Tmax 4GL Programming Guide
Tmax 4GL Programming Guide
Tmax 4GL Programming Guide
Tmax 4GL Programming Guide
Tmax 4GL Programming Guide
} Tmax 4GL Programming Guide
emp_c.mk Tmax 4GL Programming Guide
tmconfig.m *DOMAIN dom1 *NODE tmax1 *SVRGROUP svg1 *SERVER emp_c *SERVICE FDLSELECT FDLUPDATE FDLDELETE FDLINSERT SHMKEY=70000, MAXUSER=200, MINCLH=1, MAXCLH=5, TPORTNO=8888, BLOCKTIME=200, TXTIME=200 TMAXDIR="/home/tmax", APPDIR="/home/tmax/appbin", PATHDIR="/home/tmax/path", TLOGDIR= "/home/tmax/log/tlog", SLOGDIR="/home/tmax/log/slog" ULOGDIR="/home/tmax/log/ulog" NODENAME=tmax1, DBNAME=ORACLE, OPENINFO="ORACLE_XA+Acc=P/scott/tiger+SesTm=60", TMSNAME = svg1_tms SVGNAME=svg1, MIN=1 SVRNAME= emp_c SVRNAME= emp_c SVRNAME= emp_c SVRNAME= emp_c Tmax 4GL Programming Guide
IV. Visual Basic.net Tmax 4GL Programming Guide
1... atmi.vb : atmi fdl.vb : TmaxMacros.vb : WinApi.vb : windows Tmax. atmi Tmax Reference Manual Tmax Programming Guide.. Tmax 4GL Programming Guide
2. ErrorMsg Public Shared Function ErrorMsg (ByVal pbuffer As Integer, ByVal msg As String) As Integer TmaxMacros.vb. fieldkey STATLIN tpurcode MsgBox. msg MsgBox. pbuffer : msg : Dim lsndbuf, lrcvbuf As Integer Dim rlen, lret As Integer lret = tpcall("fdltoupper", lsndbuf, 0, lrcvbuf, rlen, TPNOFLAGS) If lret < 0 Then ErrorMsg(lrcvbuf, "FDLTOUPPER") End If integer : -1. FdlErrorMsg Tmax 4GL Programming Guide
FdlErrorMsg Public Shared Function FdlErrorMsg(ByVal msg As String) As Integer fdl. msg MsgBox. msg : Dim lsndbuf As Integer Dim lret As Integer lret = fbput(lsndbuf, fbget_fldkey("input"), txtsmallf.text, txtsmallf.textlength) If lret < 0 Then FdlErrorMsg("fbput") End If integer : -1. ErrorMsg Tmax 4GL Programming Guide
PUTINT Public Shared Function PUTINT(ByVal pfbuf As Integer, _ ByVal fldname As String, _ ByVal nth As Integer, _ ByRef value As Integer) As Integer Tmax fdl fbchg_tu() nth fldname value. value Integer. fbchg_tu() (nth) (value),. pfbuf : tpalloc() fballoc() fldname : (pfbuf) nth : value : Integer Dim lsndbuf As Integer Dim lret As Integer Dim tempi As Integer lsndbuf = fballoc(10, 100) tempi = CInt(txtInt.Text) lret = PUTINT(lsndbuf, "INTDATA", 2, tempi) If lret < 0 Then error processing End If integer : -1. PUTLONG, PUTDOUBLE, PUTFLOAT, PUTSHORT, PUTCAR3, PUTVAR, PUTCHR Tmax 4GL Programming Guide
PUTLONG Public Shared Function PUTLONG(ByVal pfbuf As Integer, _ ByVal fldname As String, _ ByVal nth As Integer, _ ByRef value As Long) As Integer Tmax fdl fbchg_tu() nth fldname value. valuelong. fbchg_tu() (nth) (value),. pfbuf : tpalloc() fballoc() fldname : (pfbuf) nth : value : Long Dim lsndbuf As Integer Dim lret As Integer Dim templ As Long lsndbuf = fballoc(10, 100) templ = CLong(txtLong.Text) lret = PUTLONG(lsndbuf, "LONGDATA", 2, templ) If lret < 0 Then error processing End If integer : -1. PUTINT, PUTDOUBLE, PUTFLOAT, PUTSHORT, PUTCAR3, PUTVAR, PUTCHR Tmax 4GL Programming Guide
PUTDOUBLE Public Shared Function PUTDOUBLE(ByVal pfbuf As Integer, _ ByVal fldname As String, _ ByVal nth As Integer, _ ByRef value As Double) As Integer Tmax fdl fbchg_tu() nth fldname value. valuedouble. fbchg_tu() (nth) (value),. pfbuf : tpalloc() fballoc() fldname : (pfbuf) nth : value : Double Dim lsndbuf As Integer Dim lret As Integer Dim tempd As Double lsndbuf = fballoc(10, 100) tempd = CDbl(txtDouble.Text) lret = PUTDOUBLE(lsndbuf, "DOUBLEDATA", 2, tempd) If lret < 0 Then error processing End If integer : -1. PUTINT, PUTLONG, PUTFLOAT, PUTSHORT, PUTCAR3, PUTVAR, PUTCHR Tmax 4GL Programming Guide
PUTFLOAT Public Shared Function PUTFLOAT(ByVal pfbuf As Integer, _ ByVal fldname As String, _ ByVal nth As Integer, _ ByRef value As Single) As Integer Tmax fdl fbchg_tu() nth fldname value. valuesingle. fbchg_tu() (nth) (value),. pfbuf : tpalloc() fballoc() fldname : (pfbuf) nth : value : String Dim lsndbuf As Integer Dim lret As Integer Dim temps As Single lsndbuf = fballoc(10, 100) temps = CSng(txtSingle.Text) lret = PUTFLOAT(lsndbuf, "TAPE_SENT", 2, temps) If lret < 0 Then error processing End If integer : -1. PUTINT, PUTLONG, PUTSHORT, PUTDOUBLE, PUTCAR3, PUTVAR, PUTCHR Tmax 4GL Programming Guide
PUTSHORT Public Shared Function PUTSHORT(ByVal pfbuf As Integer, _ ByVal fldname As String, _ ByVal nth As Integer, _ ByRef value As Short) As Integer Tmax fdl fbchg_tu() nth fldname value. valueshort. fbchg_tu() (nth) (value),. pfbuf : tpalloc() fballoc() fldname : (pfbuf) nth : value : Short Dim lsndbuf As Integer Dim lret As Integer Dim temps As Short lsndbuf = fballoc(10, 100) temps = CShort(txtShort.Text) lret = PUTSHORT(lsndbuf, "SUPER_NUM", 2, temps) If lret < 0 Then error processing End If integer : -1. PUTINT, PUTLONG, PUTFLOAT, PUTDOUBLE, PUTCAR3, PUTVAR, PUTCHR Tmax 4GL Programming Guide
PUTCAR3 Public Shared Function PUTCAR3(ByVal pfbuf As Integer, _ ByVal fldname As String, _ ByVal nth As Integer, _ ByRef value() As Byte, _ ByVal len As Integer) As Integer Tmax fdl fbchg_tu() nth fldname value. value Byte array. binary. fbchg_tu() (nth) (value),. pfbuf : tpalloc() fballoc() fldname : (pfbuf) nth : value : Binary len : Binary Dim lsndbuf As Integer Dim lret As Integer Dim tempb() As Short Dim fs As FileStream Dim br As BinaryReader Dim FilePath As String lsndbuf = fballoc(10, 100) fs = New FileStream(FilePath, FileMode.Open, FileAccess.Read, FileShare.None) br = New BinaryReader(fs) ReDim tempb(cint(fs.length)) br.read(tempbr, 0, CInt(fs.Length)) br.close() fs.close() lret = PUTCAR3(lsendbuf, "TP_BITMAP", 0, tempb, Cint(fs.Length)) If lret < 0 Then error processing End If Tmax 4GL Programming Guide
integer : -1. PUTINT, PUTLONG, PUTSHORT, PUTDOUBLE, PUTFLOAT, PUTVAR, PUTCHR Tmax 4GL Programming Guide
PUTVAR Public Shared Function PUTVAR(ByVal pfbuf As Integer, _ ByVal fldname As String, _ ByVal nth As Integer, _ ByVal value As String) As Integer Tmax fdl fbchg_tu() nth fldname value. valuestring. fbchg_tu() (nth) (value),. pfbuf : tpalloc() fballoc() fldname : (pfbuf) nth : value : String Dim lsndbuf As Integer Dim lret As Integer Dim temps As String lsndbuf = fballoc(10, 100) temps = txtstring.text lret = PUTVAR(lsndbuf, " FILENAME ", 2, temps) If lret < 0 Then error processing End If integer : -1. PUTINT, PUTLONG, PUTSHORT, PUTDOUBLE, PUTFLOAT, PUTCAR3, PUTCHR Tmax 4GL Programming Guide
PUTCHR Public Shared Function PUTCHR(ByVal pfbuf As Integer, _ ByVal fldname As String, _ ByVal nth As Integer, _ ByRef value As Char, _ ByVal len As Integer) As Integer Tmax fdl fbchg_tu() nth fldname value. valuechar. fbchg_tu() (nth) (value),. pfbuf : tpalloc() fballoc() fldname : (pfbuf) nth : value : Char len Char Dim lsndbuf As Integer Dim lret As Integer Dim tempc As Char lsndbuf = fballoc(10, 100) tempc = New String("a").ToCharArray() lret = PUTCHR(lsndbuf, "CHR", 0, tempc(0), 1) If lret < 0 Then error processing End If integer : -1. PUTINT, PUTLONG, PUTSHORT, PUTDOUBLE, PUTFLOAT, PUTCAR3, PUTVAR Tmax 4GL Programming Guide
PUTCAR Public Shared Function PUTCAR(ByVal pbuffer As Integer, _ ByVal value As String, _ ByVal len As Integer) As Integer carray tpalloc(). PBuffer : tpalloc () Value : String Len : String Dim lsndbuf As Integer Dim rlet As Integer Dim temps As String lsndbuf = tpalloc( CARRAY,, 0) temps = txtstring.text lret = PUTCAR(lsndbuf, temps, temps.length) If lret < 0 Then MsgBox( PUTCAR fail [ & tpstrerror(gettperrno()) & ] ) End If integer : -1. GETCAR Tmax 4GL Programming Guide
PUTCAR2 Public Shared Function PUTCAR2(ByVal pbuffer As Integer, _ ByRef value() As Byte, _ ByVal len As Integer) As Integer binary tpalloc(). pbuffer : tpalloc() value : Binary len : Binary Dim lsndbuf As Integer Dim lret As Integer Dim tempb() As Short Dim fs As FileStream Dim br As BinaryReader Dim FilePath As String lsndbuf = tpalloc( CARRAY,, 0) fs = New FileStream(FilePath, FileMode.Open, FileAccess.Read, FileShare.None) br = New BinaryReader(fs) ReDim tempb(cint(fs.length)) br.read(tempbr, 0, CInt(fs.Length)) br.close() fs.close() lret = PUTCAR2(lsendbuf, tempb, Cint(fs.Length)) If lret < 0 Then MsgBox( PUTCAR2 fail [ & tpstrerror(gettperrno()) & ] ) End If integer : -1. GETCAR2 Tmax 4GL Programming Guide
GETINT Public Shared Function GETINT(ByVal pfbuf As Integer, _ ByRef fldname As String, _ ByVal nth As Integer, _ ByRef value As Integer) As Integer Tmax fdl fbget_tu() fldname nth value. value Integer. pfbuf : tpalloc() fballoc() fldname : (pfbuf). nth : value : Dim lsndbuf As Integer Dim lret As Integer Dim tempi As Integer lsndbuf = fballoc(10, 100) lret = GETINT(lsndbuf, "INTDATA", 0, tempi) If lret < 0 Then error processing End If integer : -1. GETLONG, GETDOUBLE, GETFLOAT, GETSHORT, GETCAR3, GETVAR, GETCHR Tmax 4GL Programming Guide
GETLONG Public Shared Function GETLONG(ByVal pfbuf As Integer, _ ByRef fldname As String, _ ByVal nth As Integer, _ ByRef value As Long) As Integer Tmax fdl fbget_tu() fldname nth value. value Long. pfbuf : tpalloc() fballoc() fldname : (pfbuf). nth : value : Dim lsndbuf As Integer Dim lret As Integer Dim templ As Long lsndbuf = fballoc(10, 100) lret = GETINT(lsndbuf, "LONGDATA", 0, templ) If lret < 0 Then error processing End If integer : -1. GETINT, GETDOUBLE, GETFLOAT, GETSHORT, GETCAR3, GETVAR, GETCHR Tmax 4GL Programming Guide
GETDOUBLE Public Shared Function GETINT(ByVal pfbuf As Integer, _ ByRef fldname As String, _ ByVal nth As Integer, _ ByRef value As Double) As Integer Tmax fdl fbget_tu() fldname nth value. value Double. pfbuf : tpalloc() fballoc() fldname : (pfbuf). nth : value : Dim lsndbuf As Integer Dim lret As Integer Dim tempid As Double lsndbuf = fballoc(10, 100) lret = GETDOUBLE(lsndbuf, "DOUBLEDATA", 0, tempd) If lret < 0 Then error processing End If integer : -1. GETINT, GETLONG, GETFLOAT, GETSHORT, GETCAR3, GETVAR, GETCHR Tmax 4GL Programming Guide
GETFLOAT Public Shared Function GETFLOAT(ByVal pfbuf As Integer, _ ByRef fldname As String, _ ByVal nth As Integer, _ ByRef value As Single) As Integer Tmax fdl fbget_tu() fldname nth value. value Single. pfbuf : tpalloc() fballoc() fldname : (pfbuf). nth : value : Dim lsndbuf As Integer Dim lret As Integer Dim temps As Single lsndbuf = fballoc(10, 100) lret = GETFLOAT(lsndbuf, "TAPE_SENT", 0, temps) If lret < 0 Then error processing End If integer : -1. GETINT, GETLONG, GETDOUBLE, GETSHORT, GETCAR3, GETVAR, GETCHR Tmax 4GL Programming Guide
GETSHORT Public Shared Function GETSHORT(ByVal pfbuf As Integer, _ ByRef fldname As String, _ ByVal nth As Integer, _ ByRef value As Short) As Integer Tmax fdl fbget_tu() fldname nth value. value Short. pfbuf : tpalloc() fballoc() fldname : (pfbuf). nth : value : Dim lsndbuf As Integer Dim lret As Integer Dim temps As Short lsndbuf = fballoc(10, 100) lret = GETSHORT(lsndbuf, "SUPER_NUM", 0, temps) If lret < 0 Then error processing End If integer : -1. GETINT, GETLONG, GETDOUBLE, GETFLOAT, GETCAR3, GETVAR, GETCHR Tmax 4GL Programming Guide
GETCAR3 Public Shared Function GETCAR3(ByVal pfbuf As Integer, _ ByRef fldname As String, _ ByVal nth As Integer, _ ByRef value() As Byte, _ ByRef len As Integer) As Integer Tmax fdl fbget_tu() fldname nth value. valuebyte array. pfbuf : tpalloc() fballoc() fldname : (pfbuf). nth : value : len : Dim lsndbuf As Integer Dim lret As Integer Dim tempb() As Byte Dim len As Integer lsndbuf = fballoc(10, 100) lret = GETCAR3(lsndbuf, "TP_BITMAP", 0, tempb, len) If lret < 0 Then error processing End If integer : -1. GETINT, GETLONG, GETDOUBLE, GETFLOAT, GETSHORT, GETVAR, GETCHR Tmax 4GL Programming Guide
GETVAR Public Shared Function GETVAR(ByVal pfbuf As Integer, _ ByRef fldname As String, _ ByVal nth As Integer, _ ByRef value As String) As Integer Tmax fdl fbget_tu() fldname nth value. value String. pfbuf : tpalloc() fballoc() fldname : (pfbuf). nth : value : Dim lsndbuf As Integer Dim lret As Integer Dim temps As String lsndbuf = fballoc(10, 100) lret = GETVAR(lsndbuf, "FILENAM", 0, temps) If lret < 0 Then error processing End If integer : -1. GETINT, GETLONG, GETDOUBLE, GETFLOAT, GETSHORT, GETCAR3, GETCHR Tmax 4GL Programming Guide
GETCHR Public Shared Function GETCHR(ByVal pfbuf As Integer, _ ByRef fldname As String, _ ByVal nth As Integer, _ ByRef value As Char, _ ByRef len As Integer) As Integer Tmax fdl fbget_tu() fldname nth value. value CARRAY. GETVAR STINGCARRAY. CARRAY Len. STRING NULL. PFBUF : tpalloc() fballoc() fldname : (pfbuf). Nth : Value : Len : Dim lsndbuf As Integer Dim lret As Integer Dim tempc As Char Dim len As Integer lsndbuf = fballoc(10, 100) lret = GETCHR(lsndbuf, "CHR", 0, tempc, len) If lret < 0 Then error processing End If integer : -1. GETINT, GETLONG, GETDOUBLE, GETFLOAT, GETSHORT, GETCAR3, GETVAR Tmax 4GL Programming Guide
GETCAR Public Shared Function GETCAR(ByVal pbuffer As Integer, _ ByRef value As String, _ ByVal len As Integer) As Integer String tpalloc(). pbuffer : tpalloc() value : len : Dim lsndbuf As Integer Dim lret As Integer Dim temps As String lsndbuf = tpalloc( STRING,, 0) lret = GETCAR(lrcvbuf, temps, 10) If lret < 0 Then error processing End If integer : -1. PUTCAR Tmax 4GL Programming Guide
GETCAR2 Public Shared Function GETCAR2(ByVal pbuffer As Integer, _ ByRef value() As Byte, _ ByVal len As Integer) As Integer Binary tpalloc(). pbuffer : tpalloc() value : len : Dim lsndbuf As Integer Dim lret As Integer Dim tempb() As Byte lsndbuf = tpalloc( STRING,, 0) lret = GETCAR2(lrcvbuf, tempb, 1024) If lret < 0 Then error processing End If integer : -1. PUTCAR2 Tmax 4GL Programming Guide
FilltpstartBuf Public Shared Function FilltpstartBuf(ByVal pbuffer As Integer, _ ByVal startinfop As tpstart_t) As Integer Tmax tpstart_t. pbuffer : tpalloc() startinfo : tpstart_t Dim lsndbuf As Integer Dim lret As Integer Dim cinfo As tpstart_t lsndbuf = tpalloc("tpstart", "", 0) If lsndbuf = 0 Then error processing End If cinfo.cltname = "tmax" + Chr(0) cinfo.usrname = "tmax" + Chr(0) cinfo.dompwd = "xamt" + Chr(0) cinfo.usrpwd = "batman" + Chr(0) cinfo.flags = TPUNSOL_HND lret = FilltpstartBuf(lsndbuf, cinfo) If ret < 0 Then error processing End If ret = tpstart(lsndbuf) If ret < 0 Then error processing End integer : -1. - Tmax 4GL Programming Guide
3. Visual Basic.NET Sample account id,,,. : atmi.vb, fdl.vb, TmaxMacros.vb, WinAPI.vb. *** VB.net *** AssemblyInfo.vb CodeFile1.vb EmployeeGrid.resx EmployeeGrid.vb :. EmployeeMgr.resx EmployeeMgr.sln EmployeeMgr.suo EmployeeMgr.vb : Main.,,,. EmployeeMgr.vbproj EmployeeMgr.vbproj.user TmaxMacros.vb WinAPI.vb atmi.vb fdl.vb *** *** emp_c.mk : Makefile. emp_c.pc :. AIXOracle 9i. employee.m : Tmax *** *** demo.f : Field key bufferr. tmax. Option Explicit ' ' Private Sub BtnReturn_Click() Hide EmployeeMgr.Show End Sub ' Click ' Private Sub Form_Activate() ' tpstart ' Tmax 4GL Programming Guide
tmaxstart Dim Isendbuf As Long Dim Irecvbuf As Long Dim Irbuflen As Long Dim Iret As Integer Dim text As String Dim value As Long Dim dvalue As Double Dim svalue As Single Dim lenl As Long Dim inits, outputs As String Dim empnos, enames, jobs, mgrs, dates, sals, comms, deptnos As String Dim cntl As Long Dim eno As Long Dim txbool As Integer ' 1, 0 ' ' tpstart ' tmaxstart ' ' txbool = 0 inits = vbcrlf & vbtab & vbtab & vbtab & "***** *****" & vbcrlf & vbtab & "=========================================================" & vbcrlf & vbtab & " COMM " & vbcrlf & vbtab & "=========================================================" & vbcrlf & vbcrlf If EmployeeMgr.EditEmpNo.text = "" Then MsgBox "." Hide EmployeeMgr.Show Exit Sub End If ' ' Isendbuf = fballoc(100, 1024) If Isendbuf = Null Then TmaxError ("fballoc") Call fbfree(isendbuf) tmaxend Exit Sub End If ' ' Tmax 4GL Programming Guide
Irecvbuf = fballoc(100, 1024) If Irecvbuf = Null Then TmaxError ("fballoc") Call fbfree(irecvbuf) tmaxend Exit Sub End If '. eno = Trim(EmployeeMgr.EditEmpNo.text) Iret = fbput(byval Isendbuf, ByVal fbget_fldkey("empno"), eno, ByVal lenl) If Iret = -1 Then Call ExitSub(txbool, Isendbuf, Irecvbuf) End If ' ' Iret = tpcall(byval "FDLSELECT", ByVal Isendbuf, ByVal 0, Irecvbuf, Irbuflen, ByVal 0) If Iret = -1 Then ViewErr (Irecvbuf) Call ExitSub(txbool, Isendbuf, Irecvbuf) End If cntl = fbkeyoccur(byval Irecvbuf, ByVal fbget_fldkey("empno")) Dim i As Long For i = 0 To cntl - 1 Iret = GETLONG(ByVal Irecvbuf, "EMPNO", i, value) If Iret = -1 Then TmaxError ("GETLONG(EMPNO)") Call ExitSub(txbool, Isendbuf, Irecvbuf) End If empnos = value Iret = GETVAR(ByVal Irecvbuf, "ENAME", i, text) If Iret = -1 Then TmaxError ("GETVAR(ENAME)") Call ExitSub(txbool, Isendbuf, Irecvbuf) End If enames = text Iret = GETVAR(ByVal Irecvbuf, "JOB", i, text) If Iret = -1 Then TmaxError ("GETVAR(JOB)") Call ExitSub(txbool, Isendbuf, Irecvbuf) Tmax 4GL Programming Guide
End If jobs = text Iret = GETLONG(ByVal Irecvbuf, "MGR", i, value) If Iret = -1 Then TmaxError ("GETLONG(MGR)") Call ExitSub(txbool, Isendbuf, Irecvbuf) End If mgrs = value Iret = GETVAR(ByVal Irecvbuf, "DATE", i, text) If Iret = -1 Then TmaxError ("GETVAR(DATE)") Call ExitSub(txbool, Isendbuf, Irecvbuf) End If dates = text ' SAL float. ' ' comm.bas. ' Iret = fbget_tu(byval Irecvbuf, ByVal fbget_fldkey("sal"), i, svalue, 0) If Iret = -1 Then FdlErrorMsg ("fbget_tu") Call ExitSub(txbool, Isendbuf, Irecvbuf) End If sals = svalue Iret = GETFLOAT(ByVal Irecvbuf, "COMM", i, svalue) If Iret = -1 Then TmaxError ("GETFLOAT(COMM)") Call ExitSub(txbool, Isendbuf, Irecvbuf) End If comms = svalue Iret = GETLONG(ByVal Irecvbuf, "DEPTNO", i, value) If Iret = -1 Then TmaxError ("GETLONG(DEPTNO)") Call ExitSub(txbool, Isendbuf, Irecvbuf) End If deptnos = value & vbcrlf outputs = outputs & " " & empnos & vbtab & enames & vbtab & jobs & vbtab & mgrs & vbtab & dates & vbtab & sals & vbtab & comms & vbtab & deptnos Next i InfoText.text = inits & outputs Tmax 4GL Programming Guide
' ' LabelErr.Caption = "SAL = " & dvalue Call ExitSub(txbool, Isendbuf, Irecvbuf) End Sub Private Sub ExitSub(txbool As Integer, Isendbuf As Long, Irecvbuf As Long) If txbool = 1 Then tx_rollback End If ' ' Call fbfree(byval Isendbuf&) Call fbfree(byval Irecvbuf&) ' tpend ' tmaxend Exit Sub End Sub ' tpstart ' Private Sub tmaxstart() Dim ret As Integer '. ' ' atmi.bas. ' ' Declare Function tmaxreadenv Lib "TMAX4GL.DLL" (ByVal envfile As String, ByVal label As String) As Long ' ' Tmax Reference Manual. ' ret = tmaxreadenv("c:\tmax.env", "aix5l389") If ret < 0 Then TmaxError ("tmaxreadenv") Exit Sub End If ret = tpstart(byval 0&) If ret = -1 Then LabelErr.Caption = "tpstart error = " & gettperrno() TmaxError ("tpstart") Exit Sub Else LabelErr.Caption = "tpstart return value = " & ret & " tpstart success" End If Tmax 4GL Programming Guide
End Sub ' tpend ' Private Sub tmaxend() Dim ret As Integer ret = tpend() If ret = -1 Then LabelErr.Caption = "tpend error = " & gettperrno() TmaxError ("tpend") Exit Sub Else LabelErr.Caption = "tpreturn return value = " & ret End If End Sub ' ' Private Sub ViewErr(ByVal a As Long) 'E_TYPE 9009 long - - 'E_CODE 9010 long - - 'E_MSG 9011 string - - 'E_TMP 9012 long - - Dim typel As Long Dim codel As Long Dim msgs As String Dim tmpl As Long Dim Iret As Integer Iret = fbget_tu(byval a, ByVal fbget_fldkey("e_type"), 0, typel, 0) If Iret = -1 Then FdlErrorMsg ("fbget_tu") Exit Sub End If Iret = fbget_tu(byval a, ByVal fbget_fldkey("e_code"), 0, codel, 0) If Iret = -1 Then FdlErrorMsg ("fbget_tu") Exit Sub End If Iret = GETVAR(ByVal a, "E_MSG", 0, msgs) Iret = fbget_tu(byval a, ByVal fbget_fldkey("e_tmp"), 0, tmpl, 0) If Iret = -1 Then FdlErrorMsg ("fbget_tu") Exit Sub End If MsgBox ("Error Type : " & typel & ",Code : " & codel & ",Message : " & msgs & Tmax 4GL Programming Guide
",Tmp : " & tmpl) End Sub - Tmax : tpstart_t - : FIELD KEY BUFFER fdlc fdl - : tpcall() - : Tms AutoTransaction - : FDLSELECT, FDLINSERT - : SVRGROUP Tmax 4GL Programming Guide
EmployeeMgr EmployeeMgr Caption= LabelErr Caption= BtnExit BtnIns BtnDel BtnUdt BtnSel EditName EditEmpNo EditDept EditComm EditSal EditDate EditMgr EditJob Caption= Caption= Caption= Caption= Caption= < > Tmax 4GL Programming Guide
< > EmployeeMgr.vb source Tmax 4GL Programming Guide
Tmax 4GL Programming Guide
Tmax 4GL Programming Guide
Tmax 4GL Programming Guide
Tmax 4GL Programming Guide
Tmax 4GL Programming Guide
Tmax 4GL Programming Guide
Tmax 4GL Programming Guide
Tmax 4GL Programming Guide
Tmax 4GL Programming Guide
EmployeeGrid EmployeeGrid Caption= ListTextBox MultiLine=True BtnReturn Caption= < > < > EmployeeGrid.frm Source Tmax 4GL Programming Guide
Tmax 4GL Programming Guide
Tmax 4GL Programming Guide
Tmax 4GL Programming Guide
Tmax 4GL Programming Guide
Tmax 4GL Programming Guide
Tmax 4GL Programming Guide
Tmax 4GL Programming Guide
Tmax 4GL Programming Guide
Tmax 4GL Programming Guide
Tmax 4GL Programming Guide
Tmax 4GL Programming Guide
Tmax 4GL Programming Guide
demo.f DataBase EMP Table EMPNO NUMBER NOT NULL P1 ENAME VARCHAR(16) JOB VARCHAR(16) MGR NUMBER HIREDATE DATE SAL NUMBER(7,2) COMM NUMBER(7,2) DEPTNO NUMBER Tmax 4GL Programming Guide
emp_c.pc Tmax 4GL Programming Guide
Tmax 4GL Programming Guide
Tmax 4GL Programming Guide
Tmax 4GL Programming Guide
Tmax 4GL Programming Guide
Tmax 4GL Programming Guide
} Tmax 4GL Programming Guide
emp_c.mk Tmax 4GL Programming Guide
tmconfig.m *DOMAIN dom1 *NODE tmax1 *SVRGROUP svg1 *SERVER emp_c *SERVICE FDLSELECT FDLUPDATE FDLDELETE FDLINSERT SHMKEY=70000, MAXUSER=200, MINCLH=1, MAXCLH=5, TPORTNO=8888, BLOCKTIME=200, TXTIME=200 TMAXDIR="/home/tmax", APPDIR="/home/tmax/appbin", PATHDIR="/home/tmax/path", TLOGDIR= "/home/tmax/log/tlog", SLOGDIR="/home/tmax/log/slog" ULOGDIR="/home/tmax/log/ulog" NODENAME=tmax1, DBNAME=ORACLE, OPENINFO="ORACLE_XA+Acc=P/scott/tiger+SesTm=60", TMSNAME = svg1_tms SVGNAME=svg1, MIN=1 SVRNAME= emp_c SVRNAME= emp_c SVRNAME= emp_c SVRNAME= emp_c Tmax 4GL Programming Guide
V. C#.net Tmax 4GL Programming Guide
1... Atmi.cs : atmi Fdl.cs : Tx.cs : WinApi.cs : windows TmaxApi.cs RQ, Tmax. atmi Tmax Reference ManualTmax Programing Guide C#. Tmax 4GL Programming Guide
2. C#.NET Sample,,,,,,,. 8 singleline editor1, 6., 50.,,,. 4GL_Sample.sln : Form1.csTmax Library client emp_c.pc : service (Oracle ) demo.f : Field Key Buffer emp_c.mk: Makefile tmconfig.m : Tmax - Tmax Library : Atmi.cs, Fdl.cs, Tx.cs, WinApi.cs, TmaxApi.cs - : FIELD KEY BUFFER fdlc fdl - : pb_tpcall() - :,,, - Tmax :,. - : FDLSELECT, FDLUPDATE, FDLDELETE, FDLINSERT - : SVRGROUP ( XA ) SVRGROUP Tmax 4GL Programming Guide
< > < > Tmax 4GL Programming Guide