The script has the following four areas where it temporarily stores data for each call it handles. TSM clears these areas at the beginning of a new call.
User memory is a work area for the script to store database information, global variables, and data sent to and from the host.
The script writer is responsible for partitioning user space.
Each script is allocated 512 bytes for user space, but automatic allocations ensure up to 51,200 bytes if script data defines require additional space.
The event memory contains a record of the events that occurred for each transaction. Event memory consists of 100 32-bit integers.
Sixteen registers, r.0 through r.15, allow the script to manipulate data outside of user memory. Three of the registers perform special functions.
Register r.0 (and occasionally r.1 and r.2) is a return register that can be used to indicate the results of a specific instruction. For example, the dbase instruction (described under TAS Script Instructions) sets r.0 to a positive number on successful completion, which indicates the message contents. In general, a negative number indicates that the instruction failed. For example, if a database instruction that is supposed to receive data did not return any data, then r.0 is set to -2 after an instruction time-out period (45 seconds by default). See the nwitime instruction in TAS script instructions.
Note:
Because most of the instructions store return values in r.0, it is recommended that this register not be used for general purposes.
Register r.2 and r.3 are used to pass information to subroutines when a subroutine call is made with up to two arguments specified. The called subroutine reads the first field of information from r.3 and the second field from r.2.
A stack is a set of data storage locations that are read in a fixed sequence. The contents of r.1 through r.15 are saved on a stack when a subroutine is called. Upon return from the subroutine, they are reloaded with the stack values.