ASP Interface
This chapter describes functions used by an Active Server Page (ASP) interface with examples.
1. Overview
An ASP interface is a script that enables to dynamically develop web pages for users in a web environment. To call a Tmax service in ASP, the tmaxcomcli.dll interface provided by Tmax must be used.
tmaxcomcli.dll operates as an inprocess server with the following 4 interface modules.
Module | Description |
---|---|
Tmaxcom.Atmi |
Includes methods that wrap basic Tmax functions. |
Tmaxcom.Etc |
Includes methods that wrap functions that are not provided by Tmaxcom.Atmi. |
Tmaxcom.Fdl |
Includes methods that wrap functions for handling Tmax field buffers. |
Tmaxcom.Tx |
Includes methods that wrap Tmax transaction functions. |
A Tmax service can be used in ASP by creating an object for an interface above and then calling a corresponding method. For more information, refer to Example Program.
The following describes each method that can be used by an ASP interface.
-
Atmi interface methods
Method Description Returns an error value set when a Tmax system is called.
Returns urcode set when a service calls tpreturn()
Sends an asynchronous service request.
Allocates a typed buffer.
Sends a synchronous service request and receives its reply.
Cancels a reply with a call descriptor returned by OnTpacall().
Establishes a connection to an interactive service.
Ends a connection to an interactive service.
Ends a connection to a Tmax system.
Frees memory allocated for a typed buffer.
Gets a value to which a pointer to a buffer allocated by OnTpalloc() points.
Receives a reply to an asynchronous request of a service.
Sets a value in the location to which a pointer to a buffer allocated by OnTpalloc() points.
Reallocates a typed buffer.
Receives data sent from a connected program in interactive communication.
Sends a message in interactive communication.
Connects to a Tmax system.
Provides information about buffer type and subtype.
-
Non-Atmi interface methods
Method Description Checks whether a client is connected to a Tmax system.
Loads environment variables from a file.
Sleeps for up to sec and returns immediately when data arrives.
Sleeps for up to usec time and returns immediately when data arrives.
Reads a result of a service request through tpenq() or data that a service name was specified as NULL when tpenq() was used.
Saves data in an RQ.
Gets detailed information about an error that occurred when a Tmax system is called.
Gets detailed information about data that was read from an RQ through OnTpdeq().
Gets the name of a service that was used for data that was read from an RQ through OnTpdeq().
Returns a value in a registered environment variable.
Sets a specified value in a specified environment variable.
Returns statistics about data in a current queue.
Returns statistics about data for a specified service in a current queue.
Puts service request data that is in a fail queue into a request queue
Immediately ends a connection to a client.
Changes blocking timeout (service timeout) that is set in a server.
Returns the name of a subqueue that corresponds to a specified subqueue number.
Allows a client to connect to a Tmax backup system.
-
FDL interface method
Method Description Calculates the size of a field buffer and then allocates memory.
Calculates a field buffer size to allocate the field buffer in memory with OnTpalloc().
Deletes all data in a field with a specified key from a field buffer.
Deletes data of a specified order number in a field with a specified key from a field buffer.
Calculates and returns the number of fields in a field buffer.
Frees memory allocated to a field buffer.
Gets field data that corresponds to a specified field key from a field buffer.
Gets and returns a field buffer size.
Gets and returns a field key that corresponds to a specified field name.
Gets and returns a field name that corresponds to a specified field key.
Gets and returns the type of a specified field key as an integer.
Gets and returns the type of a specified field key as a string.
Calculates and returns the size of an unused field buffer allocated in memory.
Calculates and returns the size of a currently used field buffer allocated in memory.
Converts field data in a field buffer to a specified type and sequentially returns the converted data.
Sequentially returns field data in a field buffer.
Gets and returns the number of fields that contain specified data with a specified field key.
Gets and returns an order number of a field that contains specified data with a specified field key.
Gets field data with a specified field key and order number from a field buffer and returns the data.
Converts field data with a specified field key and order number to an integer and returns the converted data.
Converts field data with a specified field key and order number to a string and returns the converted data.
Converts field data with a specified field key and order number to a specified type and returns the converted data.
Initializes a field buffer.
Inserts data to a field with a specified field key and order number in a field buffer.
Checks whether a specified field buffer is valid (whether a variable is a buffer allocated by OnFballoc() or OnTpalloc()).
Checks whether field data with a specified field key and order number exists.
Deletes existing data loaded in memory and loads a file set in the FDLFILE environment variable.
Returns the number of fields with a specified field key in a field buffer.
Dynamically creates a field key.
Deletes existing data loaded in memory and loads a file set in the FDLFILE environment variable.
Add a field to a field buffer.
Converts data to a specified type, adds a filed to a field buffer, and then saves the data in the field.
Reallocates memory to a field buffer.
Returns a field buffer error as a string.
Converts field data to a specified type and returns the converted data.
Converts data with a specified field key and order number in a field buffer.
Returns an error value when an error occurs while a field buffer related API function is executed.
Returns an error value when an error occurs while a field buffer related API function is executed.
-
Tx interface method
Method Description Starts a global transaction.
Commits a global transaction.
Rolls back a global transaction.
Configures timeout for a global transaction.
For information about functions that are internally called by methods above, refer to Tmax FDL Reference Guide or Tmax Reference Guide. |
2. Atmi Interface Methods
2.1. OnGettperrno
Returns an error value set when a Tmax system is called.
-
Prototype
OnGettperrno()
-
Return value
Returns an error value.
-
Related functions
OnTpurcode(), OnTpstrerror()
2.2. OnGettpurcode
Returns urcode set when a service calls tpreturn().
-
Prototype
OnGettpurcode()
-
Return value
Returns urcode.
-
Related functions
OnGettperrno(), OnTpstrerror()
2.3. OnTpacall
Sends an asynchronous service request by calling tpacall().
-
Prototype
OnTpacall(VARIANT svc, VARIANT data, VARIANT len, VARIANT flags)
-
Parameter
Parameter Description svc
Name of a service to be requested.
data
Pointer to a data part of a request. If the data is not NULL, the pointer must be a pointer to a buffer allocated by OnTpalloc() or OnFballoc().
len
Length of data to be sent.
flags
flags used to call tpacall().
-
Return value
Return value Description Descriptor
Function call succeeded. This descriptor is used as a parameter of a method such as OnTpgetrply() and OnTpcancel().
-1
Function call failed. An error value is obtained by calling OnGettperrno().
-
Related functions
OnTpcall(), OnTpgetrply(), OnGettperrno()
2.4. OnTpalloc
Allocates a typed buffer by calling tpalloc().
-
Prototype
OnTpalloc(VARIANT type, VARIANT subtype, VARIANT size)
-
Parameter
Parameter Description type
Buffer type (e.g., FIELD, STRING).
subtype
Used if a structure buffer is used. This parameter is not used in ASP.
size
Buffer size.
-
Return value
Return value Description Pointer to a valid typed buffer
Function call succeeded.
NULL
Function call failed. An error value is obtained by calling OnGettperrno().
-
Related functions
OnTprealloc(), OnTpfree(), OnGettperrno()
2.5. OnTpcall
Sends a synchronous service request and receives its reply by calling tpcall().
-
Prototype
OnTpcall(VARIANT svc, VARIANT idata, VARIANT ilen, VARIANT *odata, VARIANT *olen, VARIANT flags)
-
Parameter
Parameter Description svc
Name of a service to be requested.
idata
Pointer to a data part of a request. If the data is not NULL, the pointer must be a pointer to a buffer allocated by OnTpalloc() or OnFballoc().
ilen
Length of data to be sent.
odata
Pointer to a reply receive buffer allocated by OnTpalloc() or OnFballoc().
olen
Length of data received.
flags
flags used to tpcall().
-
Return value
Return value Description 1
Function call succeeded.
-1
Function call failed. An error value is obtained by calling OnGettperrno().
-
Related functions
OnTpalloc(), OnTpacall(), OnTpgetrply(), OnGettperrno()
2.6. OnTpcancel
Cancels a reply with a call descriptor (cd) returned by OnTpacall(), by calling tpcancel().
-
Prototype
OnTpcancel(VARIANT cd)
-
Parameter
Parameter Description cd
Descriptor returned by OnTpacall().
-
Return value
Return value Description 1
Function call succeeded.
-1
Function call failed. An error value is obtained by calling OnGettperrno().
-
Related functions
OnTpacall(), OnTpgetrply(), OnGettperrno()
2.7. OnTpconnect
Establishes a connection to an interactive service by calling tpconnect().
-
Prototype
OnTpconnect(VARIANT svc, VARIANT data, VARIANT len, VARIANT flags)
-
Parameter
Parameter Description svc
Name of a service to be connected.
data
Pointer to data to be sent to a service routine during connection configuration.
len
Size of data to be sent to a service routine during connection configuration.
flags
Flags used for communication connections.
-
TPNOTRAN
-
TPSENDONLY
-
TPRECVONLY
-
TPNOTIME
-
TPSIGRSTRT
Either TPSENDONLY or TPRECVONLY must be set for OnTpconnect().
-
-
Return value
Return value Description Descriptor
Function call succeeded.
-1
Function call failed. An error value is obtained by calling OnGettperrno().
-
Related functions
OnTprecv(), OnTpsend(), OnTpdiscon(), OnGettperrno()
2.8. OnTpdiscon
Ends a connection to an interactive service by calling tpdiscon().
-
Prototype
OnTpdiscon(VARIANT cd)
-
Parameter
Parameter Description cd
Descriptor returned by OnTpconnect().
-
Return value
Return value Description 1
Function call succeeded.
-1
Function call failed. An error value is obtained by calling OnGettperrno().
-
Related functions
OnTpconnect(), OnTprecv(), OnTpsend(), OnGettperrno()
2.9. OnTpend
Ends a connection to a Tmax system by calling tpend().
-
Prototype
OnTpend()
-
Return value
Return value Description 1
Function call succeeded.
-1
Function call failed. An error value is obtained by calling OnGettperrno().
-
Related functions
OnTpstart(), OnGettperrno()
2.10. OnTpfree
Frees memory allocated for a typed buffer by calling tpfree().
-
Prototype
OnTpfree(VARIANT ptr)
-
Parameter
Parameter Description ptr
Pointer to a buffer to which memory to be freed was allocated.
-
Return value
None.
-
Related functions
OnTpalloc()
2.11. OnTpget
Gets a value to which a pointer to a buffer allocated by OnTpalloc() points.
-
Prototype
OnTpget(VARIANT buf, VARIANT *loc)
-
Parameter
Parameter Description buf
Pointer to a buffer allocated by OnTpalloc().
value
Variable used to receive a value.
-
Return value
Return value Description 1
Function call succeeded.
-1
Function call failed.
-
Example
Dim buf Dim rVal Dim msg Dim i ... buf = OnTpalloc ("STRING", "", CINT(0)) ... OnTpput buf, "abcd" rVal = OnTpcall("TOUPPER", buf, CINT(0), buf2, i, CINT(0)) ... OnTpget buf, msg ...
-
Related functions
OnTpput()
2.12. OnTpgetrply
Receives a reply to an asynchronous request of a service by calling tpgetrply().
-
Prototype
OnTpgetrply(VARIANT cd, VARIANT *data, VARIANT *len, VARIANT flags)
-
Parameter
Parameter Description cd
Descriptor returned by OnTpacal().
data
Pointer to a reply receive buffer allocated by OnTpalloc() or OnFballoc().
len
Length of data received.
flags
flags used to call tpcall().
-
Return value
Return value Description 1
Function call succeeded.
-1
Function call failed. An error value is obtained by calling OnGettperrno().
-
Related functions
OnTpalloc(), OnTpacall(), OnGettperrno()
2.13. OnTpput
Sets a value in the location to which a pointer to a buffer allocated by OnTpalloc() points.
-
Prototype
OnTpput(VARIANT *buf, VARIANT value)
-
Parameter
Parameter Description buf
Pointer to a buffer allocated by OnTpalloc().
value
Value to be set in buf.
-
Return value
Return value Description 1
Function call succeeded.
-1
Function call failed.
-
Example
Dim buf Dim rVal Dim msg Dim i ... buf = OnTpalloc ("STRING", "", CINT(0)) ... OnTpput buf, "abcd" rVal = OnTpcall("TOUPPER", buf, CINT(0), buf2, i, CINT(0)) ... OnTpget buf, msg ...
-
Related functions
OnTpget()
2.14. OnTprealloc
Reallocates a typed buffer by calling tprealloc().
-
Prototype
OnTprealloc(VARIANT ptr, VARIANT size)
-
Parameter
Parameter Description ptr
Pointer to a typed buffer to be reallocated.
size
Size of a typed buffer to be reallocated.
-
Return value
Return value Description Pointer to a valid typed buffer
Function call succeeded.
NULL
Function call failed. An error value is obtained by calling OnGettperrno().
-
Related functions
OnTpalloc(), OnTpfree(), OnGettperrno()
2.15. OnTprecv
Receives data sent from a connected program in interactive communication by calling tprecv().
-
Prototype
OnTprecv(VARIANT cd, VARIANT *data, VARIANT *len, VARIANT flags, VARIANT *revent)
-
Parameter
Parameter Description cd
Descriptor returned by OnTpconnect().
data
Data receive buffer allocated by OnTpalloc() or OnFballoc().
len
Variable used to receive the data length.
flags
Flags that can be set in communication with an interactive service.
The following flags values are available:
-
TPNOCHANGE
-
TPNOBLOCK
-
TPNOTIME
-
TPSIGRSTRT
revent
If an event for the cd parameter exists, OnTpsend() will fail and data will not be sent. The event type is returned and saved in revent.
The following events are available:
-
TPEV_DISCONIMM
-
TPEV_SVCERR
-
TPEV_SVCFAIL
For more information, refer to Tmax Reference Guide.
-
-
Return value
Return value Description 1
Function call succeeded.
-1
Function call failed. If revent is TREV_SVCFAIL, urcode sent when tpreturn() is called is set and used by OnGettpurcode().
-
Related functions
OnTpconnect(), OnTpsend(), OnTpdiscon(), OnGettperrno()
2.16. OnTpsend
Sends a message in interactive communication by calling tpsend(). A function caller must have a communication control.
-
Prototype
OnTpsend(VARIANT cd, VARIANT data, VARIANT len, VARIANT flags, VARIANT *revent)
-
Parameter
Parameter Description cd
Descriptor returned by OnTpconnect().
data
Buffer allocated by OnTpalloc() or OnFballoc().
len
Data length.
flags
Flags that can be set in communication with an interactive service.
The following flags values are available:
-
TPNOBLOCK
-
TPNOTIME
-
TPRECVONLY
-
TPSIGRSTRT
revent
If an event for the cd parameter exists, OnTpsend() will fail and data will not be sent. The event type is returned and saved in revent.
The following events are available:
-
TPEV_DISCONIMM
-
TPEV_SVCERR
-
TPEV_SVCFAIL
For more information, refer to Tmax Reference Guide.
-
-
Return value
Return value Description 1
Function call succeeded.
-1
Function call failed. If revent is TREV_SVCFAIL, urcode sent when tpreturn() is called is set and used by OnGettpurcode().
-
Related functions
OnTpconnect(), OnTprecv(), OnTpdiscon(), OnGettperrno()
2.17. OnTpstart
Connects to a Tmax system by calling tpstart(). This function receives a member to be used as a parameter of TPSTART_T through a parameter.
-
Prototype
OnTpstart(VARIANT usrname, VARIANT cltname, VARIANT dompwd, VARIANT usrpwd, VARIANT flags)
-
Parameter
Parameter Description usrname
Client name.
cltname
Account used for user authentication security
dompwd
Password used for system access security.
usrpwd
Password used for user authentication security.
flags
Determines an unrequested message type and system access method.
-
Return value
Return value Description 0 (main)
1 (backup)
Function call succeeded.
-1
Function call failed. An error value is obtained by calling OnGettperrno().
-
Related functions
OnTpend(), OnTmaxreadenv(), OnGettperrno()
2.18. OnTptypes
Provides information about buffer type and subtype by calling tptypes().
-
Prototype
OnTptypes(VARIANT ptr, VARIANT *type, VARIANT *subtype)
-
Parameter
Parameter Description ptr
Pointer to a buffer allocated by OnTpalloc() or OnFballoc().
type
Type of a pointer to a buffer allocated by OnTpalloc() or OnFballoc().
subtype
Subtype of a pointer to a buffer allocated by OnTpalloc() or OnFballoc().
-
Return value
Return value Description Buffer size
Function call succeeded.
-1
Function call failed. An error value is obtained by calling OnGettperrno().
-
Related functions
OnTpsubtypes(), OnGettperrno()
3. Non-Atmi Interface Methods
3.1. OnTmax_chk_conn
Checks whether a client is connected to a Tmax system by calling tptobackup().
-
Prototype
OnTmax_chk_conn(VARIANT timeout)
-
Parameter
Parameter Description timeout
Blocking timeout.
-
Return value
Return value Description 0
Function call succeeded.
-1
Function call failed. An error value is obtained by calling OnGettperrno().
3.2. OnTmaxreadenv
Loads environment variables from a file by calling tmaxreadenv().
-
Prototype
OnTmaxreadenv(VARIANT file, VARIANT label)
-
Parameter
Parameter Description file
Name of a file that includes environment information of a system to be connected.
label
Delimiter for environment information registered in a file.
-
Return value
Return value Description 1
Function call succeeded.
-1
Function call failed.
-
Related functions
OnTpstart()
3.3. OnTp_sleep
Sleeps until data arrives and immediately returns the data when the data arrives by calling tp_sleep(). This function sleeps for a specified time and then returns if the time is reached.
-
Prototype
OnTp_sleep(VARIANT sec)
-
Parameter
Parameter Description sec
Maximum time to wait for data. (Unit: seconds)
-
Return value
Return value Description -1
Function call failed. An error value is obtained by calling OnGettperrno().
0
Data did not arrive for a time specified in sec.
Positive integer
Data arrived.
-
Related functions
OnTp_usleep()
3.4. OnTp_usleep
Sleeps until data arrives and immediately returns the data when the data arrives by calling tp_usleep(). This function sleeps for a specified time and then returns if the time is reached.
-
Prototype
OnTp_sleep(VARIANT usec)
-
Parameter
Parameter Description usec
Maximum time to wait for data. (Unit: milliseconds)
-
Return value
Return value Description -1
Function call failed. An error value is obtained by calling OnGettperrno().
0
Data did not arrive for a time specified in usec.
Positive integer
Data arrived.
-
Related functions
OnTp_usleep()
3.5. OnTpdeq
Reads a result of a service request through tpenq() or data that a service name was specified as NULL when tpenq() was used, by calling tpdeq(). If TPNOREPLY is set to flags when tpenq() is used, a service result cannot be received.
-
Prototype
OnTpdeq(VARIANT qname, VARIANT svc, VARIANT *data, VARIANT *len, VARIANT flags)
-
Parameter
Parameter Description qname
Name of an RQ in which data was saved.
svc
Same name as that used in OnTpenq().
data
Buffer allocated by OnTpalloc() or OnFballoc(). A service result will be sent to this buffer.
len
Length of data to be received.
flags
Same flags values as the values that are available in tpdeq() can be set.
-
Return value
Return value Description 1
Function call succeeded.
-1
Function call failed. An error value is obtained by calling OnGettperrno().
-
Related functions
OnTpenq()
3.6. OnTpenq
Saves data in an RQ by calling tpenq().
-
Prototype
OnTpenq(VARIANT qname, VARIANT svc, VARIANT data, VARIANT len, VARIANT flags)
-
Parameter
qname Name of an RQ in which data will be saved. svc
Name of a service to be requested. If the name is NULL, data will be saved in an RQ and no service is executed. If the name is not NULL, data will be saved in an RQ and then the service will be executed.
data
Pointer to data to be requested through a service. A buffer that contains the data must have been allocated by OnTpalloc() or OnFballoc() unless the value is NULL.
len
Length of data to be sent.
flags
Same flags values as the values that are available in tpenq() can be set.
-
Return value
Return value Description queue descriptor (qd)
Function call succeeded.
-1
Function call failed. An error value is obtained by calling OnGettperrno().
-
Related functions
OnTpdeq()
3.7. OnTperrordetail
Gets detailed information about an error that occurred when a Tmax system is called, by calling tperrordetail().
-
Prototype
OnTperrordetail(VARIANT i)
-
Parameter
Parameter Description i
Error value.
-
Return value
Return value Description -1
An unknown error occurred.
1
An application error occurred.
2
A system error occurred.
3.8. OnTpextsvcinfo
Gets detailed information about data that was read from an RQ through OnTpdeq(), by calling tpextsvcinfo().
-
Prototype
OnTpextsvcinfo(VARIANT data, VARIANT *svc, VARIANT *type, VARIANT *errcode)
-
Parameter
Parameter Description data
Pointer to data that was read through OnTpdeq(). A buffer that contains the data must have been allocated by OnTpalloc() or OnFballoc().
svc
Variable in which a service name will be saved.
type
One of the following values that show a result of the data.
-
TPREQ(0)
-
TPFAIL(1)
-
TPSUCCESS(2)
-
TPERR(-1)
errcode
Error code that will be set if an error occurs.
-
-
Return value
Return value Description 1
Function call succeeded.
-1
Function call failed. An error value is obtained by calling OnGettperrno().
3.9. OnTpextsvcname
Gets the name of a service that was used for data that was read from an RQ through OnTpdeq(), by calling tpextsvcname().
-
Prototype
OnTpextsvcname(VARIANT data, VARIANT *svc)
-
Parameter
Parameter Description data
Pointer to data that was read through OnTpdeq(). A buffer that contains the data must have been allocated by OnTpalloc() or OnFballoc().
svc
Variable in which a service name will be saved.
-
Return value
Return value Description 1
Function call succeeded.
-1
Function call failed. An error value is obtained by calling OnGettperrno().
3.10. OnTpgetenv
Returns a value in a registered environment variable by calling tpgetenv().
-
Prototype
OnTpgetenv(VARIANT str)
-
Parameter
Parameter Description str
Name of a registered environment variable.
-
Return value
Return value Description Pointer to a value in an environment variable
Function call succeeded.
NULL
Function call failed.
-
Related functions
OnTpputenv()
3.11. OnTpputenv
Sets a specified value in a specified environment variable by calling tpputenv(). If the environment variable already exists, existing value will be replaced. If not, a new value will be added.
-
Prototype
OnTpputenv(VARIANT str)
-
Parameter
Parameter Description str
Value to be saved in an environment variable.
-
Return value
Return value Description 1
Function call succeeded.
-1
Function call failed.
-
Related functions
OnTpgetenv()
3.12. OnTpqstat
Returns statistics about data in a current queue by calling tpqstat().
-
Prototype
OnTpqstat(VARIANT qname, VARIANT type)
-
Parameter
Parameter Description qname
Name of an RQ registered in a Tmax configuration file.
type
One of the following values can be set.
-
0: Used to compile statistics about data in fail, request, and reply queues.
-
1: Used to compile statistics about data in a fail queue.
-
2: Used to compile statistics about data in a request queue.
-
3: Used to compile statistics about data in a reply queue.
-
-
Return value
Return value Description Statistics
Function call succeeded.
-1
Function call failed. An error value is obtained by calling OnGettperrno().
-
Related functions
OnTpsvcstat()
3.13. OnTpqsvcstat
Returns statistics about data for a specified service in a current queue by calling tpqsvcstat.
-
Prototype
OnTpqsvcstat(VARIANT qname, VARIANT svc, VARIANT type)
-
Parameter
Parameter Description qname
Name of an RQ registered in a Tmax configuration file.
svc
Name of a service for which statistics will be compiled. If this name is NULL, a result will be the same as in OnTpqstat().
type
One of the following values can be set.
-
0: Used to compile statistics about data in fail, request, and reply queues.
-
1: Used to compile statistics about data in a fail queue.
-
2: Used to compile statistics about data in a request queue.
-
3: Used to compile statistics about dat in a reply queue.
-
-
Return value
Return value Description Statistics
Function call succeeded.
-1
Function call failed. An error value is obtained by calling OnGettperrno().
-
Related functions
OnTpqstat()
3.14. OnTpreissue
Puts service request data that is in a fail queue into a request queue, by calling tpreissue(). Data can be in a fail queue because a service fails due to a network or server error during the service execution with an RQ by using OnTpdeq().
-
Prototype
OnTpreissue(VARIANT qname, VARIANT filter, VARIANT flags)
-
Parameter
Parameter Description qname
Name of RQ registered in a Tmax configuration file.
filter
Not supported. NULL is set.
flags
Not supported. 0 is set.
-
Return value
Return value Description 0 (Normal)
Function call succeeded.
-1
Function call failed. An error value is obtained by calling OnGettperrno().
-
Related functions
OnTpenq(), OnTpdeq()
3.15. OnTpreset
Immediately ends a connection to a client by calling tpreset().
-
Prototype
OnTpreset()
-
Return value
Return value Description 1
Function call succeeded.
-1
Function call failed. An error value is obtained by calling OnGettperrno().
3.16. OnTpset_timeout
Changes blocking timeout (service timeout) that is set in a server by calling tpset_timeout().
-
Prototype
OnTpset_timeout(VARIANT sec)
-
Parameter
Parameter Description sec
Blocking timeout.
-
Return value
Return value Description 0
Function call succeeded.
-1
Function call failed. An error value is obtained by calling OnGettperrno().
3.17. OnTpsubqname
Returns the name of a subqueue that corresponds to a specified subqueue number by calling tpsubqname().
-
Prototype
OnTpsubqname(VARIANT type)
-
Parameter
Parameter Description type
One of the following can be specified as a subqueue number.
-
0: RQ_ANY (fail, request, reply queues)
-
1: RQ_FAIL (fail queue)
-
2: RQ_REQ (request queue)
-
3: RQ_RPLY (reply queue)
-
-
Return value
Return value Description Subqueue name
Function call succeeded.
NULL
Function call failed. An error value is obtained by calling OnGettperrno().
3.18. OnTptobackup
Allows a client to connect to a Tmax backup system by calling tptobackup. To use this method, TMAX_BACKUP_ADDR and TMAX_BACKUP_PORT must have been set.
-
Prototype
OnTptobackup()
-
Return value
Return value Description 1
Function call succeeded.
-1
Function call failed. An error value is obtained by calling OnGettperrno().
-
Related functions
OnTpstart()
4. FDL Interface Methods
4.1. OnFballoc
Calculates the size of a field buffer and then allocates memory by calling fballoc().
-
Prototype
OnFballoc(VARIANT count, VARIANT len)
-
Parameter
Parameter Description count
Number of fields in which data will be saved.
len
Total data size. (Unit: bytes)
-
Return value
Return value Description Pointer to an allocated memory
Function call succeeded.
NULL
Function call failed. An error value is obtained by calling OnGettperrno().
-
Related functions
OnFbcalcsize(), OnTpalloc()
4.2. OnFbcalcsize
Calculates a field buffer size to allocate the field buffer in memory with OnTpalloc(), by calling fbcalcsize().
-
Prototype
OnFbcalcsize(VARIANT count, VARIANT datalen)
-
Parameter
Parameter Description count
Number of fields in which data will be saved.
datalen
Data size in a field buffer. (Unit: bytes)
-
Return value
Field buffer size in bytes.
-
Related functions
OnFballoc(), OnTpalloc()
4.3. OnFbdelall
Deletes all data in a field with a specified key from a field buffer by calling fbdelall().
-
Prototype
OnFbdelall(VARIANT fbuf, VARIANT fldkey)
-
Parameter
Parameter Description fbuf
Pointer to a buffer allocated by OnTpalloc() or OnFballoc().
fldkey
Field key.
-
Return value
Return value Description Number of deleted fields
Function call succeeded.
-1
A specified field key cannot be found in a field buffer. An error value is obtained by calling OnGettperrno().
4.4. OnFbdelete
Deletes data of a specified order number in a field with a specified key from a field buffer by calling fbdelete().
-
Prototype
OnFbdelete(VARIANT fbuf, VARIANT fldkey, VARIANT nth)
-
Parameter
Parameter Description fbuf
Pointer to a buffer allocated by OnTpalloc() or OnFballoc().
fldkey
Field key.
nth
Order number of a field.
-
Return value
Return value Description 1
Function call succeeded.
-1
Function call failed. An error value is obtained by calling OnGettperrno().
-
Related functions
OnFbupdate(), OnFbinsert()
4.5. OnFbfldcount
Calculates and returns the number of fields in a field buffer by calling fbfldcount().
-
Prototype
OnFbfldcount(VARIANT fbuf)
-
Parameter
Parameter Description fbuf
Pointer to a buffer allocated by OnTpalloc() or OnFballoc().
-
Return value
Number of fields in a specified field buffer. If no field exists, 0 will be returned.
4.6. OnFbfree
Frees memory allocated to a field buffer by calling fbfree().
-
Prototype
OnFbfree(VARIANT fbuf)
-
Parameter
Parameter Description fbuf
Pointer to a buffer allocated by OnTpalloc() or OnFballoc().
-
Return value
Return value Description 1
Function call succeeded.
-1
Function call failed. An error value is obtained by calling OnGetfberrno().
-
Related functions
OnFballoc(), OnTpalloc(), OnTpfree()
4.7. OnFbget
Gets field data that corresponds to a specified field key from a field buffer by calling fbget().
-
Prototype
OnFbget(VARIANT fbuf, VARIANT fldkey, VARIANT *loc, VARIANT *fldlen)
-
Parameter
Parameter Description fbuf
Pointer to a buffer allocated by OnTpalloc() or OnFballoc().
fldkey
Field key.
loc
Buffer in which field data will be saved. This buffer must have been allocated by OnTpalloc().
fldlen
Length of field data to be received.
-
Return value
Return value Description 1
Function call succeeded.
-1
Function call failed. An error value is obtained by calling OnGettperrno().
-
Related functions
OnFbput(), OnFbgett()
4.8. OnFbget_fbsize
Gets and returns a field buffer size by calling fbfree().
-
Prototype
OnFbget_fbsize(VARIANT fbuf)
-
Parameter
Parameter Description fbuf
Pointer to a buffer allocated by OnTpalloc() or OnFballoc().
-
Return value
Size of a field buffer allocated in memory.
-
Related functions
OnFballoc(), OnTpalloc()
4.9. OnFbget_fldkey
Gets and returns a field key that corresponds to a specified field name by calling fbget_fldkey().
-
Prototype
OnFbget_fldkey(VARIANT name)
-
Parameter
Parameter Description name
Field name.
-
Return value
Return value Description Field key
Function call succeeded.
0
A specified field name does not exist in a field table.
-
Related functions
OnFbget_fldname(), OnFbget_fldtype()
4.10. OnFbget_fldname
Gets and returns a field name that corresponds to a specified field key by calling fbget_fldname().
-
Prototype
OnFbget_fldname(VARIANT fldkey)
-
Parameter
Parameter Description fldkey
Field key.
-
Return value
Return value Description Field name
Function call succeeded.
NULL
A field name that corresponds to a specified field key does not exist in a field table.
-
Related functions
OnFbget_fldkey(), OnFbget_fldtype()
4.11. OnFbget_fldtype
Gets and returns the type of a specified field key as an integer by calling fbget_fldtype().
-
Prototype
OnFbget_fldtype(VARIANT fldkey)
-
Parameter
Parameter Description fldkey
Field key.
-
Return value
Return value Field Type 1
character
2
short integer
3
integer
4
long integer
5
float
6
double
7
string
8
character array (CARRAY)
-
Related functions
OnFbget_fldkey(), OnFbget_fldname()
4.12. OnFbget_strfldtype
Gets and returns the type of a specified field key as a string by calling fbget_strfldtype().
-
Prototype
OnFbget_strfdltype(VARIANT fldkey)
-
Parameter
Parameter Description fldkey
Field key.
-
Return value
Return value Description Empty string
There is no field type that corresponds to a specified field key, or the specified field key is invalid.
String
A field type that corresponds to a specified field key is returned as a string.
-
Related functions
OnFbget_fldtype()
4.13. OnFbget_unused
Calculates and returns the size of an unused field buffer allocated in memory by calling fbget_unused()
-
Prototype
OnFbget_unused(VARIANT fbuf)
-
Parameter
Parameter Description fbuf
Pointer to a buffer allocated by OnTpalloc() or OnFballoc().
-
Return value
Size of unused memory allocated to a field buffer in bytes.
-
Related functions
OnFbget_used()
4.14. OnFbget_used
Calculates and returns the size of a currently used field buffer allocated in memory by calling fbget_used().
-
Prototype
OnFbget_used(VARIANT fbuf)
-
Parameter
Parameter Description fbuf
Pointer to a buffer allocated by OnTpalloc() or OnFballoc().
-
Return value
Size of currently used memory allocated to a field buffer in bytes.
-
Related functions
OnFbget_unused()
4.15. OnFbgetc
Converts field data in a field buffer to a specified type and sequentially returns the converted data, by calling fbgetc().
-
Prototype
OnFbgetc(VARIANT fbuf, VARIANT fldkey, VARIANT *loc, VARIANT *len, VARIANT *pos, VARIANT totype)
-
Parameter
Parameter Description fbuf
Pointer to a buffer allocated by OnTpalloc() or OnFballoc().
fldkey
Field key.
loc
Buffer in which field data to be received will be saved. This buffer must have been allocated by OnTpalloc().
fldlen
Length of field data to be received.
pos
Position of next data to be read.
totype
One of the following types to which field data can be converted.
-
FB_CARRAY(8)
-
FB_SHORT(2)
-
FB_DOUBLE(6)
-
FB_LONG(4)
-
FB_STRING(7)
-
FB_CHAR(1)
-
FB_FLOAT(5)
-
FB_INT(3)
-
-
Return value
Return value Description 1
Function call succeeded.
-1
A specified field key does not exist in a field buffer. An error value is obtained by calling OnGettperrno().
-
Related functions
OnFbget(), OnFbgetf()
4.16. OnFbgetf
Sequentially returns field data in a field buffer by calling fbgetf().
-
Prototype
OnFbgetf(VARIANT fbuf, VARIANT fldkey, VARIANT *loc, VARIANT *fldlen, VARIANT *pos)
-
Parameter
Parameter Description fbuf
Pointer to a buffer allocated by OnTpalloc() or OnFballoc().
fldkey
Field key.
loc
Buffer in which field data to be received will be saved. This buffer must have been allocated by OnTpalloc().
fldlen
Length of field data to be received.
pos
Position of next data to be read.
-
Return value
Return value Description 1
Function call succeeded.
-1
A specified field key does not exist in a field buffer. An error value is obtained by calling OnGettperrno().
-
Related functions
OnFbget(), OnFbgetc()
4.17. OnFbgetnth
Gets and returns the number of fields that contain specified data with a specified field key, by calling fbgetnth().
-
Prototype
OnFbgetnth(VARIANT fbuf, VARIANT fldkey, VARIANT value, VARIANT len)
-
Parameter
Parameter Description fbuf
Pointer to a buffer allocated by OnTpalloc() or OnFballoc().
fldkey
Field key.
value
Data to be searched for.
len
Length of data to be searched for.
-
Return value
Return value Description The number of fields
Function call succeeded.
-1
A specified field key does not exist in a field buffer. An error value is obtained by calling OnGettperrno().
4.18. OnFbgetntht
Gets and returns an order number of a field that contains specified data with a specified field key, by calling fbgetntht().
-
Prototype
OnFbgetntht(VARIANT fbuf, VARIANT fldkey, VARIANT value, VARIANT len, VARIANT fromtype)
-
Parameter
Parameter Description fbuf
Pointer to a buffer allocated by OnTpalloc() or OnFballoc().
fldkey
Field key.
value
Data to be searched for.
len
Length of data to be searched for.
fromtype
Field type. If a data type set in this fromtype parameter is different from the type of a field with a specified field key set in the fldkey parameter, the type of data set in the value parameter will be converted to the field type.
One of the following field types can be set.
-
FB_CHAR(1)
-
FB_SHORT(2)
-
FB_INT(3)
-
FB_LONG(4)
-
FB_FLOAT(5)
-
FB_DOUBLE(6)
-
FB_STRING(7)
-
FB_CARRAY(8)
-
-
Return value
Return value Description Order number of a field
Function call succeeded.
-1
A specified field key does not exist in a field buffer. An error value is obtained by calling OnGettperrno().
-
Related functions
OnFbgetntht()
4.19. OnFbgetval
Gets field data with a specified field key and order number from a field buffer and returns the data, by calling fbgetval().
-
Prototype
OnFbgetval(VARIANT fbuf, VARIANT fldkey, VARIANT nth, VARIANT *len)
-
Parameter
Parameter Description fbuf
Pointer to a buffer allocated by OnTpalloc() or OnFballoc().
fldkey
Field key.
nth
Order number of a field.
len
Length of data to be read.
-
Return value
Return value Description String
Function call succeeded.
NULL
A specified field key or order number does not exist in a field buffer. An error value is obtained by calling OnGettperrno().
-
Related functions
OnFbgetvalt(), OnFbgetvals(), OnFbgetvali()
4.20. OnFbgetvali
Converts field data with a specified field key and order number to an integer and returns the converted data, by calling fbgetvali().
-
Prototype
OnFbgetvali(VARIANT fbuf, VARIANT fldkey, VARIANT nth)
-
Parameter
Parameter Description fbuf
Pointer to a buffer allocated by OnTpalloc() or OnFballoc().
fldkey
Field key.
nth
Order number of a field.
-
Return value
Return value Description Integer
Function call succeeded.
-1
A specified field key does not exist in a field buffer, or an error occurred during the function execution. An error value is obtained by calling OnGettperrno().
-
Related functions
OnFbgetvalt(), OnFbgetvals(), OnFbgetval()
4.21. OnFbgetvals
Converts field data with a specified field key and order number to a string and returns the converted data, by calling fbgetvals().
-
Prototype
OnFbgetvals(VARIANT fbuf, VARIANT fldkey, VARIANT nth)
-
Parameter
Parameter Description fbuf
Pointer to a buffer allocated by OnTpalloc() or OnFballoc().
fldkey
Field key.
nth
Order number of a field.
-
Return value
Return value Description String
Function call succeeded.
NULL
A specified field key does not exist in a field buffer, or an error occurred during the function execution. An error value is obtained by calling OnGettperrno().
-
Related functions
OnFbgetvalt(), OnFbgetval(), OnFbgetvali()
4.22. OnFbgetvalt
Converts field data with a specified field key and order number to a specified type and returns the converted data, by calling fbgetvalt().
-
Prototype
OnFbgetvalt(VARIANT fbuf, VARIANT fldkey, VARIANT nth, VARIANT *len, VARIANT totype)
-
Parameter
Parameter Description fbuf
Pointer to a buffer allocated by OnTpalloc() or OnFballoc().
fldkey
Field key.
nth
Order number of a field.
len
Length of data to be read.
type
Type to which field data to be read will be converted.
One of the following field types can be set.
-
FB_CHAR(1)
-
FB_SHORT(2)
-
FB_INT(3)
-
FB_LONG(4)
-
FB_FLOAT(5)
-
FB_DOUBLE(6)
-
FB_STRING(7)
-
FB_CARRAY(8)
-
-
Return value
Return value Description String
Function call succeeded.
NULL
A specified field key does not exist in a field buffer. An error value is obtained by calling OnGettperrno().
-
Related functions
OnFbgetval(), OnFbgetvals(), OnFbgetvali()
4.23. OnFbinit
Initializes a field buffer by calling fbinit().
-
Prototype
OnFbinit(VARIANT fbuf, VARIANT len)
-
Parameter
Parameter Description fbuf
Pointer to a buffer allocated by OnTpalloc() or OnFballoc().
len
Size of a buffer to be initialized.
-
Return value
Return value Description 1
Function call succeeded.
-1
Function call failed. An error value is obtained by calling OnGetfberrno().
4.24. OnFbinsert
Inserts data to a field with a specified field key and order number in a field buffer, by calling fbinsert().
-
Prototype
OnFbinsert(VARIANT fbuf, VARIANT fldkey, VARIANT nth, VARIANT value, VARIANT fldlen)
-
Parameter
Parameter Description fbuf
Pointer to a buffer allocated by OnTpalloc() or OnFballoc().
fldkey
Field key.
nth
Order number of a field.
value
Data to be inserted.
fldlen
Length of data to be inserted.
-
Return value
Return value Description 1
Function call succeeded.
-1
Function call failed. An error value is obtained by calling OnGettperrno().
-
Related functions
OnFbdelete(), OnFbupdate()
4.25. OnFbisfbuf
Checks whether a specified field buffer is valid (whether a variable is a buffer allocated by OnFballoc() or OnTpalloc()) by calling fbisfbuf().
-
Prototype
OnFbisfbuf(VARIANT fbuf)
-
Parameter
Parameter Description fbuf
Variable to be checked.
-
Return value
Return value Description 0
Function call succeeded.
1
A specified field buffer is valid.
-
Related functions
OnFballoc(), OnTpalloc()
4.26. OnFbispres
Checks whether field data with a specified field key and order number exists by calling fbispres().
-
Prototype
OnFbispres(VARIANT fbuf, VARIANT fldkey, VARIANT nth)
-
Parameter
Parameter Description fbuf
Pointer to a buffer allocated by OnTpalloc() or OnFballoc().
fldkey
Field key.
nth
Order number of a field.
-
Return value
Return value Description 0
Function call succeeded.
1
Field data with a field key and order number exists.
4.27. OnFbkeynm_unload
Deletes existing data loaded in memory and loads a file set in the FDLFILE environment variable, by calling fbkeynm_unload(). This function is used to load a new FDL file to memory.
-
Prototype
OnFbkeynm_unload()
-
Related functions
OnFbnmkey_unload
4.28. OnFbkeyoccur
Returns the number of fields with a specified field key in a field buffer by calling fbkeyoccur().
-
Prototype
OnFbkeyoccur(VARIANT fbuf, VARIANT fldkey)
-
Parameter
Parameter Description fbuf
Pointer to a buffer allocated by OnTpalloc() or OnFballoc().
fldkey
Field key.
-
Return value
Return value Description The number of fields
Function call succeeded.
0
No field data with a specified field key exists in a field buffer. An error value is obtained by calling OnGettperrno().
-1
Function call failed.
4.29. OnFbmake_fldkey
Dynamically creates a field key by calling fbmake_fldkey().
-
Prototype
OnFbmake_fldkey(VARIANT type, VARIANT no)
-
Parameter
Parameter Description type
Type of a field to be created. One of the following types can be set.
-
FB_CHAR(1)
-
FB_SHORT(2)
-
FB_INT(3)
-
FB_LONG(4)
-
FB_FLOAT(5)
-
FB_DOUBLE(6)
-
FB_STRING(7)
-
FB_CARRAY(8)
no
Number of a field to be created.
-
-
Return value
Return value Description Field key
A new field key with a specified type and number was created.
String
A field type received through a parameter for a field key to be created already exists.
4.30. OnFbnmkey_unload
Deletes existing data loaded in memory and loads a file set in the FDLFILE environment variable, by calling fbnmkey_unload(). This function is used to load a new FDL file to memory.
-
Prototype
OnFbnmkey_unload()
-
Related functions
OnFbkeynm_unload
4.31. OnFbput
Add a field to a field buffer by calling fbput().
-
Prototype
OnFbput(VARIANT fbuf, VARIANT fldkey, VARIANT value, VARIANT fldlen)
-
Parameter
Parameter Description fbuf
Pointer to a buffer allocated by OnTpalloc() or OnFballoc().
fldkey
Field key.
value
Data to be added.
fldlen
Length of data to be added.
-
Return value
Return value Description 1
Function call succeeded.
-1
Function call failed. An error value is obtained by calling OnGettperrno().
-
Related functions
OnFbget(), OnFbputt()
4.32. OnFbputt
Converts data to a specified type, adds a filed to a field buffer, and then saves the data in the field by calling fbputt().
-
Prototype
OnFbputt(VARIANT fbuf, VARIANT fldkey, VARIANT value, VARIANT len, VARIANT type)
-
Parameter
Parameter Description fbuf
Pointer to a buffer allocated by OnTpalloc() or OnFballoc().
fldkey
Field key.
value
Data to be added.
len
Length of data to be added.
type
Type to which data to be saved will be converted.
One of the following types can be set.
-
FB_CHAR(1)
-
FB_SHORT(2)
-
FB_INT(3)
-
FB_LONG(4)
-
FB_FLOAT(5)
-
FB_DOUBLE(6)
-
FB_STRING(7)
-
FB_CARRAY(8)
-
-
Return value
Return value Description 1
Function call succeeded.
-1
Failed to add a field to a field buffer. An error value is obtained by calling OnGettperrno().
-
Related functions
OnFbput()
4.33. OnFbrealloc
Reallocates memory to a field buffer by calling fbget_used().
-
Prototype
OnFbrealloc(VARIANT fbuf, VARIANT ncount, VARIANT nlen)
-
Parameter
Parameter Description fbuf
Pointer to a buffer allocated by OnTpalloc() or OnFballoc().
ncount
Number of fields in which data will be saved.
nlen
Total data size. (Unit: bytes)
-
Return value
Return value Description Pointer to allocated memory
Function call succeeded.
NULL
Function call failed. An error value is obtained by calling OnGettperrno().
-
Related functions
OnFballoc(), OnTpalloc()
4.34. OnFbstrerror
Returns a field buffer error as a string by calling fbstrerror().
-
Prototype
OnFbstrerror(VARIANT err_no)
-
Parameter
Parameter Description err_no
Error value.
-
Return value
Return value Description String
Function call succeeded.
NULL
Function call failed.
-
Related functions
OnFbcalcsize(), OnTpalloc()
4.35. OnFbtypecvt
Converts field data to a specified type and returns the converted data by calling fbtypecvt().
-
Prototype
OnFbtypecvt(VARIANT *tolen, VARIANT totype, VARIANT fromval, VARIANT fromtype, VARIANT fromlen)
-
Parameter
Parameter Description tolen
Length of converted data.
totype
Type to which original data will be converted.
fromval
Original data to be converted.
fromtype
Type of original data to be converted.
fromlen
Length of original data to be converted.
-
Return value
Return value Description Pointer to converted data
Function call succeeded.
NULL
Failed to convert data. An error value is obtained by calling OnGettperrno().
4.36. OnFbupdate
Converts data with a specified field key and order number in a field buffer by calling fbupdate().
-
Prototype
OnFbupdate(VARIANT fbuf, VARIANT fldkey, VARIANT nth, VARIANT value, VARIANT fldlen)
-
Parameter
Parameter Description fbuf
Pointer to a buffer allocated by OnTpalloc() or OnFballoc().
fldkey
Field key.
nth
Order number of a field.
value
Data to be converted.
fldlen
Length of data to be converted.
-
Return value
Return value Description 1
Function call succeeded.
-1
Function call failed. An error value is obtained by calling OnGettperrno().
-
Related functions
OnFbdelete(), OnFbinsert()
5. Tx Interface Methods
5.1. OnTx_begin
Starts a global transaction by calling tx_begin().
-
Prototype
OnTx_begin()
-
Return value
Return value Description 0
Function call succeeded.
Negative value
Function call failed.
-
Related functions
OnTx_commit(), OnTx_rollback(), OnTx_set_transaction_timeout()
5.2. OnTx_commit
Commits a global transaction by calling tx_commit().
-
Prototype
OnTx_commit()
-
Return value
Return value Description 0
Function call succeeded.
Negative value
Function call failed.
-
Related functions
OnTx_begin(), OnTx_rollback(), OnTx_set_transaction_timeout()
5.3. OnTx_rollback
Rolls back a global transaction by calling tx_rollback().
-
Prototype
OnTx_rollback()
-
Return value
Return value Description 0
Function call succeeded.
Negative value
Function call failed.
-
Related functions
OnTx_begin(), OnTx_commit(), OnTx_set_transaction_timeout()
5.4. OnTx_set_transaction_timeout
Configures timeout for a global transaction by calling tx_set_transaction_timeout().
-
Prototype
OnTx_set_transaction_timeout(VARIANT timeout)
-
Return value
Return value Description 0
Function call succeeded.
-
Related functions
OnTx_begin(), OnTx_commit(), OnTx_rollback()
6. Example Program
The following describes an example program that queries, modifies, deletes, and adds office numbers, phone numbers, and addresses with a key of an account number. Filed key buffers are used in the program.
6.1. Program Organization
The example program consists of the following files.
File | Description |
---|---|
Tmaxtest.asp |
Main screen. |
insert.asp |
If the [INSERT] button is clicked, a corresponding request will be sent to Tmax and a result of the request will be received and then sent to TmaxTestTx.asp. |
update.asp |
If the [UPDATE] button is clicked, a corresponding request will be sent to Tmax and a result of the request will be received and then sent to TmaxTestTx.asp. |
delete.asp |
If the [DELETE] button is clicked, a corresponding request will be sent to Tmax and a result of the request will be received and then sent to TmaxTestTx.asp. |
select.asp |
If the [SELECT] button is clicked, a corresponding request will be sent to Tmax and a result of the request will be received and then sent to TmaxTestTx.asp. |
6.2. Program Description
The following describes each program.
-
Client program
Item Description Tmax library connection
Tmaxcom.Atmi, Tmaxcom.Etc, Tmaxcom.Fdl, and Tmaxcom.Tx are added.
Buffer
'fdl' files need to be created by compiling FIELD KEY buffers and field key files with the fdlc utility.
Communication
Synchronous communication is made by using OnTpcall().
Transaction
Transactions for queries, modifications, deletions, and additions are handled.
Tmax connection
A connection is established whenever a service is executed, and the connection is ended when the service is completed.
-
Server program
Item Description Service
SELECT, UPDATE, DELETE, and INSERT are written.
Database
Oracle database is used. Database information (XA method) is specified in SVRGROUP of a system configuration file.
6.3. Client Program
Main Screen
Run "regsvr32 tmaxcomcli.dll" in Windows command window and then execute the client program. The following screen with [INSERT], [UPDATE], [DELETE], and [SELECT] buttons appears.
I/O Management
The following is an example file for input/output through account numbers.
<Tmaxtest.asp>
<HTML> <HEAD> <TITLE> New Document </TITLE> <META NAME="Generator" CONTENT="EditPlus"> <META NAME="Author" CONTENT=""> <META NAME="Keywords" CONTENT=""> <META NAME="Description" CONTENT=""> </HEAD> <% Dim retStr Dim retAccount Dim retBranch Dim retPhone Dim retAddr retStr = request("retStr") retAccount = request("retAccount") retBranch = request("retBranch") retPhone = request("retPhone") retAddr = request("retAddr") %> <script language="javascript"> function insertPage(){ var accountValue = document.form1.taccount_id.value; var branchValue = document.form1.tbranch_id.value; var phoneValue = document.form1.tphone.value; var addrValue = document.form1.taddr.value; location.href="insert.asp?taccount_id="+accountValue+"&tbranch_id= "+branchValue+"&tphone="+phoneValue+"&taddr="+addrValue; } function updatePage(){ var accountValue = document.form1.taccount_id.value; var branchValue = document.form1.tbranch_id.value; var phoneValue = document.form1.tphone.value; var addrValue = document.form1.taddr.value; location.href="update.asp?taccount_id="+accountValue+"&tbranch_id= "+branchValue+"&tphone="+phoneValue+"&taddr="+addrValue; } function deletePage(){ var accountValue = document.form1.taccount_id.value; location.href="delete.asp?taccount_id="+accountValue; } function selectPage(){ var accountValue = document.form1.taccount_id.value; location.href="select.asp?taccount_id="+accountValue; } </script> <BODY> <form action="" name="form1" method="get"> <TABLE> <TR> <TD colspan=2>account number</TD> <TD colspan=2><INPUT TYPE="text" NAME="taccount_id"></TD> </TR> <TR> <TD colspan=2>office number</TD> <TD colspan=2><INPUT TYPE="text" NAME="tbranch_id" value="<%if retBranch<> "" then response.write retBranch else response.write "" end if %>"> </TD> </TR> <TR> <TD colspan=2>phone number</TD> <TD colspan=2><INPUT TYPE="text" NAME="tphone" value="<%if retPhone<> "" then response.write retPhone else response.write "" end if %>"> </TD> </TR> <TR> <TD colspan=2>address</TD> <TD colspan=2><INPUT TYPE="text" NAME="taddr" value="<%if retAddr<> "" then response.write retAddr else response.write "" end if %>"></TD> </TR> <TR> <TD colspan=2>result value</TD> <TD colspan=2><INPUT TYPE="text" NAME="trval" value="<%if retStr<> "" then response.write retStr else response.write "" end if %>"></TD> </TR> <TR> <TD> <INPUT TYPE="button" NAME="insert" value="INSERT" onclick="insertPage();"> </TD> <TD> <INPUT TYPE="button" NAME="update" value="UPDATE" onclick="updatePage();"> </TD> <TD > <INPUT TYPE="button" NAME="delete" value="DELETE" onclick="deletePage();"> </TD> <TD> <INPUT TYPE="button" NAME="select" value="SELECT" onclick="selectPage();"> </TD> </TR> </TABLE></form> </BODY> </HTML>
INSERT Button Execution Script
The following is an example file for the [INSERT] button.
<insert.asp>
<% Dim file Dim label Dim tmp 'Variable used to communicate with Tmax Dim fbuf 'Variable used to read a value that was saved in fbuf in the INSERT service Dim retStr 'Variable used to save a value that was received in TmaxTestTx.asp Dim taccount_id Dim tranch_id Dim tphone Dim taddr Dim rlen Dim rVal Dim errno 'Configuring a value that was received in TmaxTestTx.asp taccount_id = request("taccount_id") tbranch_id = request("tbranch_id") tphone = request("tphone") taddr = request("taddr") 'Creating objects for an ASP interface Set objAtmi = Server.CreateObject("Tmaxcom.Atmi") Set objFdl = Server.CreateObject("Tmaxcom.Fdl") Set objEtc = Server.CreateObject("Tmaxcom.Etc") Set objTx = Server.CreateObject("Tmaxcom.Tx") ... file = "C:\\Inetpub\\wwwroot\\tmax.env" label = "TMAXC1" 'Reading envrionment variables by using OnTmaxreadenv() to access Tmax rVal = objEtc.OnTmaxreadenv (file, label) if rVal < 0 then error processing ... end if 'Accessing Tmax by using OnTpstart() tmp = "" rVal = objAtmi.OnTpstart (tmp, tmp, tmp, tmp, CINT(0)) if rVal < 0 then error processing ... end if 'Allocating a buffer by using OnTpalloc() 'Send buffer/Receive Buffer fbuf = objAtmi.OnTpalloc ("FIELD", "", CINT(0)) 'Buffer in which field data will be received retStr = objAtmi.OnTpalloc ("STRING", "", CINT(0)) 'Inserting field data to a send buffer 'INSERT_ID ((FLDKEY)201327592) /* number: 1000 type: int */ 'BRANCH_ID ((FLDKEY)201327593) /* number: 1001 type: int */ 'PHONE ((FLDKEY)469763050) /* number: 1002 type: string */ 'ADDRESS ((FLDKEY)469763051) /* number: 1003 type: string */ rVal = objFdl.OnFbput (fbuf, "201327592", taccount_id, CINT("0")) if rVal < 0 then error processing ... end if rVal = objFdl.OnFbput (fbuf, "201327593", tbranch_id, CINT("0")) if rVal < 0 then error processing ... end if rVal = objFdl.OnFbput (fbuf, "469763050", tphone, CINT("0")) if rVal < 0 then error processing ... end if rVal = objFdl.OnFbput (fbuf, "469763051", taddr, CINT("0")) if rVal < 0 then error processing ... end if 'Starting a transaction rVal = objTx.OnTx_begin() if rVal < 0 then error processing ... end if 'Requesting an INSERT service to Tmax rVal = objAtmi.OnTpcall ("INSERT", fbuf, CINT(0), fbuf, rlen, CINT("0")) if rVal < 0 then error processing ... rVal = objTx.OnTx_rollback() if rVal < 0 then error processing ... end if 'Ending a connection to Tmax ... else rVal = objTx.OnTx_commit() if rVal < 0 then error processing ... end if end if 'Getting RESULT field data from fbuf, which is a result of OnTpcall() 'RESULT ((FLDKEY)469764048) /* number: 2000 type: string */ rVal = objFdl.OnFbget (fbuf, "469764048", retStr, rlen) if rVal < 0 then error processing ... end if 'Getting actual data from a buffer that has RESULT field data rVal = objAtmi.OnTpget (retStr, tmp) if rVal < 0 then error processing ... end if 'Releasing buffers objAtmi.OnTpfree(fbuf) objAtmi.OnTpfree(retStr) 'Ending a connection to Tmax rVal = objAtmi.OnTpend() if rVal < 0 then error processing ... end if 'Releasing objects Set objAtmi = nothing Set objFdl = nothing Set objEtc = nothing Set objTx = nothing response.redirect "TmaxTestTx.asp?retStr="&tmp %>
UPDATE Button Execution Script
The following is an example file for the [UPDATE] button.
<update.asp>
<% Dim file Dim label Dim tmp 'Variable used to communicate with Tmax Dim fbuf 'Variable used to read a value that was saved in fbuf in the UPDATE service Dim retStr 'Variable used to save a value that was received in TmaxTestTx.asp Dim taccount_id Dim tranch_id Dim tphone Dim taddr Dim rlen Dim rVal Dim errno 'Configuring a value that was received in TmaxTestTx.asp taccount_id = request("taccount_id") tbranch_id = request("tbranch_id") tphone = request("tphone") taddr = request("taddr") 'Creating objects for an ASP interface Set objAtmi = Server.CreateObject("Tmaxcom.Atmi") Set objFdl = Server.CreateObject("Tmaxcom.Fdl") Set objEtc = Server.CreateObject("Tmaxcom.Etc") Set objTx = Server.CreateObject("Tmaxcom.Tx") %> <script language="javascript"> alert("taccount_id[<%=taccount_id%>] tbranch_id[<%=tbranch_id%>] thpone[<%=tphone%>] taddr[<%=taddr%>]"); </script> <% file = "C:\\Inetpub\\wwwroot\\tmax.env" label = "TMAXC1" 'Reading envrionment variables by using OnTmaxreadenv() to access Tmax rVal = objEtc.OnTmaxreadenv (file, label) if rVal < 0 then error processing ... end if 'Accessing Tmax by using OnTpstart() tmp = "" rVal = objAtmi.OnTpstart (tmp, tmp, tmp, tmp, CINT(0)) if rVal < 0 then error processing ... end if 'Allocating a buffer by using OnTpalloc() 'Send buffer/Receive Buffer fbuf = objAtmi.OnTpalloc ("FIELD", "", CINT(0)) 'Buffer in which field data will be received retStr = objAtmi.OnTpalloc ("STRING", "", CINT(0)) 'Inserting field data to a send buffer 'UPDATE_ID ((FLDKEY)201327596) /* number: 1004 type: int */ 'BRANCH_ID ((FLDKEY)201327593) /* number: 1001 type: int */ 'PHONE ((FLDKEY)469763050) /* number: 1002 type: string */ 'ADDRESS ((FLDKEY)469763051) /* number: 1003 type: string */ rVal = objFdl.OnFbput(fbuf, "201327596", taccount_id, CINT("0")) if rVal < 0 then error processing ... end if rVal = objFdl.OnFbput(fbuf, "201327593", tbranch_id, CINT("0")) if rVal < 0 then error processing ... end if rVal = objFdl.OnFbput(fbuf, "469763050", tphone, CINT("0")) if rVal < 0 then error processing ... end if rVal = objFdl.OnFbput(fbuf, "469763051", taddr, CINT("0")) if rVal < 0 then error processing ... end if 'Starting a transaction rVal = objTx.OnTx_begin() if rVal < 0 then error processing ... end if 'Requesting an INSERT service to Tmax rVal = objAtmi.OnTpcall("UPDATE", fbuf, CINT(0), fbuf, rlen, CINT("0")) if rVal < 0 then error processing ... if rVal < 0 then errno = objAtmi.OnGettperrno() response.write("OnTx_rollback fail["&rVal&"] ["&errno&"]") end if ... else rVal = objTx.OnTx_commit() if rVal < 0 then error processing ... end if end if 'Getting RESULT field data from fbuf, which is a result of OnTpcall() 'RESULT ((FLDKEY)469764048) /* number: 2000 type: string */ rVal = objFdl.OnFbget(fbuf, "469764048", retStr, rlen) if rVal < 0 then error processing ... end if 'Getting actual data from a buffer that has RESULT field data rVal = objAtmi.OnTpget (retStr, tmp) if rVal < 0 then error processing ... end if 'Releasing buffers objAtmi.OnTpfree(fbuf) objAtmi.OnTpfree(retStr) 'Ending a connection to Tmax rVal = objAtmi.OnTpend() if rVal < 0 then error processing ... end if 'Releasing objects Set objAtmi = nothing Set objFdl = nothing Set objEtc = nothing Set objTx = nothing response.redirect "TmaxTestTx.asp?retStr="&tmp %>
DELETE Button Execution Script
The following is an example file for the [DELETE] button.
<delete.asp>
<% Dim file Dim label Dim tmp 'Variable used to communicate with Tmax Dim fbuf 'Variable used to read a value that was saved in fbuf in the INSERT service Dim retStr 'Variable used to save a value that was received in TmaxTestTx.asp Dim taccount_id Dim rlen Dim rVal Dim errno 'Configuring a value that was received in TmaxTestTx.asp taccount_id = request("taccount_id") 'Creating objects for an ASP interface Set objAtmi = Server.CreateObject("Tmaxcom.Atmi") Set objFdl = Server.CreateObject("Tmaxcom.Fdl") Set objEtc = Server.CreateObject("Tmaxcom.Etc") Set objTx = Server.CreateObject("Tmaxcom.Tx") %> <script language="javascript"> alert("taccount_id[<%=taccount_id%>]"); </script> <% file = "C:\\Inetpub\\wwwroot\\tmax.env" label = "TMAXC1" 'Reading envrionment variables by using OnTmaxreadenv() to access Tmax rVal = objEtc.OnTmaxreadenv (file, label) if rVal < 0 then error processing ... end if 'Accessing Tmax by using OnTpstart() tmp = "" rVal = objAtmi.OnTpstart (tmp, tmp, tmp, tmp, CINT(0)) if rVal < 0 then error processing ... end if 'Allocating a buffer by using OnTpalloc() 'Send buffer/Receive Buffer fbuf = objAtmi.OnTpalloc ("FIELD", "", CINT(0)) 'Buffer in which field data will be received retStr = objAtmi.OnTpalloc ("STRING", "", CINT(0)) 'Inserting field data to a send buffer 'DELETE_ID ((FLDKEY)201327597) /* number: 1005 type: int */ rVal = objFdl.OnFbput (fbuf, "201327597", taccount_id, CINT("0")) if rVal < 0 then error processing ... end if 'Starting a transaction rVal = objTx.OnTx_begin() if rVal < 0 then error processing ... end if 'Requesting a DELETE service to Tmax rVal = objAtmi.OnTpcall ("DELETE", fbuf, CINT(0), fbuf, rlen, CINT("0")) if rVal < 0 then error processing ... rVal = objTx.OnTx_rollback() if rVal < 0 then errno = objAtmi.OnGettperrno() response.write("OnTx_rollback fail["&rVal&"] ["&errno&"]") end if ... else rVal = objTx.OnTx_commit() if rVal < 0 then error processing ... end if end if 'Getting RESULT field data from fbuf, which is a result of OnTpcall() 'RESULT ((FLDKEY)469764048) /* number: 2000 type: string */ rVal = objFdl.OnFbget (fbuf, "469764048", retStr, rlen) if rVal < 0 then error processing ... end if 'Getting actual data from a buffer that has RESULT field data rVal = objAtmi.OnTpget (retStr, tmp) if rVal < 0 then error processing ... end if 'Releasing buffers objAtmi.OnTpfree(fbuf) objAtmi.OnTpfree(retStr) 'Ending a connection to Tmax rVal = objAtmi.OnTpend() if rVal < 0 then error processing ... end if 'Releasing objects Set objAtmi = nothing Set objFdl = nothing Set objEtc = nothing Set objTx = nothing response.redirect "TmaxTestTx.asp?retStr="&tmp %>
SELECT Button Execution Script
The following is an example file for the [SELECT] button.
<select.asp>
<% Dim file Dim label Dim tmp 'Variable used to communicate with Tmax Dim fbuf 'Variable used to read a value that was saved in fbuf in the INSERT service Dim str Dim branch Dim phone Dim addr 'Variable used to save a value that was received in TmaxTestTx.asp Dim taccount_id 'Variable used to send a value to TmaxTestTx.asp Dim retStr Dim retBranch Dim retPhone Dim retAddr Dim rlen Dim rVal Dim errno 'Configuring a value that was received in TmaxTestTx.asp taccount_id = request("taccount_id") 'Creating objects for an ASP interface Set objAtmi = Server.CreateObject("Tmaxcom.Atmi") Set objFdl = Server.CreateObject("Tmaxcom.Fdl") Set objEtc = Server.CreateObject("Tmaxcom.Etc") Set objTx = Server.CreateObject("Tmaxcom.Tx") %> <script language="javascript"> alert("taccount_id[<%=taccount_id%>]"); </script> <% file = "C:\\Inetpub\\wwwroot\\tmax.env" label = "TMAXC1" 'Reading envrionment variables by using OnTmaxreadenv() to access Tmax rVal = objEtc.OnTmaxreadenv (file, label) if rVal < 0 then error processing ... end if 'Accessing Tmax by using OnTpstart() tmp = "" rVal = objAtmi.OnTpstart (tmp, tmp, tmp, tmp, CINT(0)) if rVal < 0 then error processing ... end if 'Allocating a buffer by using OnTpalloc() 'Send buffer/Receive Buffer fbuf = objAtmi.OnTpalloc ("FIELD", "", CINT(0)) 'Buffer in which field data will be received str = objAtmi.OnTpalloc ("STRING", "", CINT(0)) branch = objAtmi.OnTpalloc ("STRING", "", CINT(0)) phone = objAtmi.OnTpalloc ("STRING", "", CINT(0)) addr = objAtmi.OnTpalloc ("STRING", "", CINT(0)) 'Inserting field data to a send buffer 'SELECT_ID ((FLDKEY)201327598) /* number: 1006 type: int */ rVal = objFdl.OnFbput (fbuf, "201327598", taccount_id, CINT("0")) if rVal < 0 then error processing ... end if 'Starting a transaction rVal = objTx.OnTx_begin() if rVal < 0 then error processing ... end if 'Requesting a SELECT service to Tmax rVal = objAtmi.OnTpcall ("SELECT", fbuf, CINT(0), fbuf, rlen, CINT("0")) if rVal < 0 then error processing ... rVal = objTx.OnTx_rollback() if rVal < 0 then errno = objAtmi.OnGettperrno() response.write("OnTx_rollback fail["&rVal&"] ["&errno&"]") end if ... else rVal = objTx.OnTx_commit() if rVal < 0 then error processing ... end if end if 'Getting RESULT field data from fbuf, which is a result of OnTpcall() 'RESULT ((FLDKEY)469764048) /* number: 2000 type: string */ rVal = objFdl.OnFbget (fbuf, "469764048", str, rlen) if rVal < 0 then error processing ... end if 'Getting actual data from a buffer that has RESULT field data rVal = objAtmi.OnTpget (str, retStr) if rVal < 0 then error processing ... end if 'BRANCH_ID ((FLDKEY)201327593) /* number: 1001 type: int */ 'PHONE ((FLDKEY)469763050) /* number: 1002 type: string */ 'ADDRESS ((FLDKEY)469763051) /* number: 1003 type: string */ rVal = objFdl.OnFbget (fbuf, "201327593", branch, rlen) rVal = objAtmi.OnTpget(branch, retBranch) rVal = objFdl.OnFbget (fbuf, "469763050", phone, rlen) rVal = objAtmi.OnTpget(phone, retPhone) rVal = objFdl.OnFbget (fbuf, "469763051", addr, rlen) rVal = objAtmi.OnTpget(addr, retAddr) 'Releasing buffers objAtmi.OnTpfree(fbuf) objAtmi.OnTpfree(str) objAtmi.OnTpfree(branch) objAtmi.OnTpfree(phone) objAtmi.OnTpfree(addr) 'Ending a connection to Tmax rVal = objAtmi.OnTpend() if rVal < 0 then error processing ... end if 'Releasing objects Set objAtmi = nothing Set objFdl = nothing Set objEtc = nothing Set objTx = nothing response.redirect "TmaxTestTx.asp?retStr="&retStr&"&retBranch="&retBranch&"& retPhone="&retPhone&"&retAddr="&retAddr %>