There is an important PROIV programming consideration when using functions in component mode.  Many applications depend on having all functions executed by a particular user see the same value of @TERM for the duration of the application, with each user of the application seeing a different value. This is not true for functions executing in component mode, and may necessitate some application changes.

In component mode, the value of @TERM is derived from one or more values found in the executing kernel’s process (or thread) table maintained by the operating system.  (Note that the method of calculating the value is subject to change from release to release without notice.)  It is guaranteed that each active kernel in the kernel pool will have a unique value for @TERM, and for a given execution of a Task, all the member functions will see the same value of @TERM. (There is one small exception to this rule in the UNIX environment, described in Logon Link to Function as a Task.)

However, the Kernel Manager can select a different kernel for each Task request. This means that it is not possible for the programmer to key data for a given user that is persistent from Task execution to Task execution to the value of @TERM. The first execution will see one value of @TERM, and the next will see a different value if a different kernel is used for that execution.  Indeed it is possible (though not guaranteed) for one user’s Task to see a particular value of @TERM, and for another user’s subsequent execution of the same, or a different Task, to see the same value if the same kernel is used for the second execution. (For additional information, see the UNIX Environment Variable TTY_MIXED-CASE.)

  • Data that needs to have a lifetime across Task executions can be handled in a number of ways. Here are two examples:

  • The data can be handled as one or more parameters, and be passed back to the calling application at the end of the first execution and passed into the second execution.

The first execution can generate a guaranteed unique value that is used to name a local file on the kernel’s machine. The data is then written to this file. The key is passed back to the calling application as a parameter, and passed in again (to open and read the file) on the invocation of second and subsequent executions.

Comment on this topic

Topic ID: 540171

Table of Contents

Index

Glossary

-Search-

Back