The persistent macro functions support transaction processing in Net.Data by helping you define which macro blocks are persistent within a single transaction. Use these functions to define the start and end of a transaction, which HTML blocks are persistent throughout the transaction, the scope of the variables within the transaction, and whether to commit or rollback changes within the transaction.
| AIX | HP-UX | OS/2 | OS/390 | OS/400 | SCO | SUN | Win NT |
|
|
|
|
| X |
|
|
|
Purpose
Defines the transaction handle used to invoke a persistent macro. Net.Data requires that the transaction handle be included in the URL that invokes the macro as a response from the Web browser. When a request comes in to the Web server, the server uses the transaction handle to route the request to the CGI process that is processing the transaction.
The transaction handle must be called at the start of each HTML block in the macro until the last logical block, which contains a call to DTW_TERMINATE(). If either a call to DTW_ACCEPT() or DTW_TERMINATE() is not found before any text is output to the browser, a Net.Data error occurs.
You can specify a timeout value for this page that overrides the timeout value specified on the @DTW_STATIC() function. The Web server waits for specified amount of time (in seconds) for the user to respond to this request.
If this function is called when the macro is not in a persistent state, a Net.Data error occurs.
Tip: The URLs containing the transaction handle can be coded as actions on form push buttons or as hypertext links on the page presented to the browser.
Format
@DTW_ACCEPT(handle, timeout)
@DTW_ACCEPT(handle)
Values
Table 113. DTW_ACCEPT Parameters
| Data Type | Parameter | Use | Description |
|---|---|---|---|
| string | handle | IN | A variable or literal string specifying a transaction handle to be used in URLs for subsequent macro invocations in this persistent transaction. |
| integer | timeout | IN | A variable or literal string specifying an amount of time in seconds for the job servicing this port to wait for a response. This value overrides any timeout value specified on the DTW_STATIC() function. |
Examples
Example 1:
%DEFINE handle = ""
@DTW_RTVHANLDE(handle)
%HTML(REPORT){
@DTW_ACCEPT(handle)
...
%}
| AIX | HP-UX | OS/2 | OS/390 | OS/400 | SCO | SUN | Win NT |
|
|
|
|
| X |
|
|
|
Purpose
Makes permanent any pending changes made to resources under commitment control since the last commitment boundary and establishes a new commitment boundary.
Format
@DTW_COMMIT()
Values
None.
Examples
Example 1: Specifies a commit
@DTW_COMMIT()
%HTML(report){
%}
| AIX | HP-UX | OS/2 | OS/390 | OS/400 | SCO | SUN | Win NT |
|
|
|
|
| X |
|
|
|
Purpose
Reestablishes the last commitment boundary as the current commitment boundary. All changes to resources under commitment control for the process that Net.Data is running under made since the last commitment boundary are backed out.
Format
@DTW_ROLLBACK()
Values
None.
Examples
Example 1: Specifies a rollback
@DTW_ROLLBACK()
%HTML(report){
%}
| AIX | HP-UX | OS/2 | OS/390 | OS/400 | SCO | SUN | Win NT |
|
|
|
|
| X |
|
|
|
Purpose
Generates and returns a transaction handle that is unique to this macro across separate invocations and is calculated based on a combination of thread information, timestamp, and current user (if any). The transaction handle can be used to ensure that URLs specified as part of a persistent transaction are unique to the HTTP server and can be securely identified as valid requests.
Format
@DTW_RTVHANDLE(handle)
Values
Table 114. DTW_RTVHANDLE Parameters
| Data Type | Parameter | Use | Description |
|---|---|---|---|
| string | handle | OUT | A variable that contains a unique transaction handle for the current persistent macro. |
Examples
Example 1: Defines the handle variable used to retrieve the transaction handle
%DEFINE handle = "" @DTW_RTVHANLDE(handle)
| AIX | HP-UX | OS/2 | OS/390 | OS/400 | SCO | SUN | Win NT |
|
|
|
|
| X |
|
|
|
Purpose
Indicates that the entire macro is persistent. It should be the first statement in the macro. All variables defined in the macro after this function call will be persistent across multiple macro invocations unless specified otherwise and until DTW_TERMINATE() is called or the process is ended.
A timeout value, in seconds, can be specified on the function call to indicate the amount of time the process Net.Data is running under waits for a response from the browser. If the timeout value expires, the process ends, and all changes to resources under commitment control since the last commitment boundary are rolled back.
If a timeout value is specified on a subsequent @DTW_ACCEPT() call, Net.Data overrides this value with the value in the subsequent call. If a timeout value is not specified on this call or a subsequent @DTW_ACCEPT() call, the Web server default timeout value is used.
Format
@DTW_STATIC(timeout)
@DTW_STATIC()
Values
Table 115. DTW_STATIC Parameters
| Data Type | Parameter | Use | Description |
|---|---|---|---|
| integer | timeout | IN | A variable or literal string that specifies an amount of time, in seconds, that the process handling this transaction should wait for a response. |
Examples
Example 1: A call to DTW_STATIC() specifying a timeout value of 60 seconds.
@DTW_STATIC("60")
| AIX | HP-UX | OS/2 | OS/390 | OS/400 | SCO | SUN | Win NT |
|
|
|
|
| X |
|
|
|
Purpose
Ends a persistent transaction. All changes to resources under commitment control since the last commitment boundary are made permanent.
The DTW_TERMINATE function is called at the start of the logical last HTML block of the persistent transaction before any text is output to the browser. If any text output appears before the function, within the block, a Net.Data error will occur. Note that there could be more than one logical last HTML block depending on how the application is written. If this function is called when the macro is not in a persistent state, a Net.Data error will occur.
Format
@DTW_TERMINATE()
Values
None
Examples
Example 1: Terminates the persistent transaction
%HTML(QUIT){
@DTW_TERMINATE()
...
%}