IBM Books

Administration and Programming Guide for OS/400


Transaction Management with Persistent Macros

Net.Data provides support for transaction processing with persistent macros. A persistent macro is a macro that contains built-in functions that enable the macro to run as part of a persistent CGI process in the Web server. This means that multiple blocks of a macro, or multiple macros, can run as part of a single logical transaction.

With non-persistent macros, Net.Data treats each macro invocation as one complete transaction. This means that after each response is sent to the browser, databases are committed, resources are released, and everything is set to an initial state. The next invocation of the same macro results in re-establishing the state of the application based on information passed into the macro as form data or information in the macro itself. There is no capability to save macro variables across invocations, to rollback database changes without explicitly undoing the changes made, or to treat database changes across multiple browser sessions as one complete transaction.

With persistent macros, as an application developer, you can build your application at a transaction level, invoking one or more macros while maintaining a persistent connection. This means variable data is persistent across invocations, so that you no longer need to pass information (such as user login ID) between macro invocations as hidden variables. This includes Net.Data table variables, which cannot be passed across invocations in non-persistent macros. Most important, the application can rollback all the work if the user decides to cancel out while in the middle of a transaction.

See Invoking a Persistent Macro to learn about invoking persistent macros.

This chapter describes the following topics:


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]