![]() Task and Function Parameter Usage |
![]() DEVELOPER |
![]() |
Each Task and function data parameter has an associated usage. There are four possible usages:
-
In - An In parameter is passed from the caller into the Task or function at the start of its execution. However, its (possibly changed) value is not passed back to the caller on exit. It corresponds to a Call by Value parameter in many programming languages.
-
Out - An Out parameter’s value is not passed into the Task or function when it starts executing, but its value is returned to the caller when the Task is completed. If an Out parameter is used before being assigned a value, its initial value is NULL.
-
Both - A Both parameter is passed into the Task or function from the caller, and its (possibly changed) value is returned to the caller when the function or Task terminates. An Out parameter is similar to a Call by Reference parameter in other programming languages.
-
Global - A Global data element can only be a function parameter, not a Task parameter. A Global data element can be used as a variable whose value persists through the execution of every function in the Task, but whose value vanishes when the Task exits. You cannot directly pass a Task parameter into a Global data element, nor can you directly pass a Global data element back to the task caller. Instead, you have to map a local variable to the Global data element, map another local variable to the Task parameter, and assign the second variable to the first variable before the function exits. A second function that maps the same Global data element to a local variable will find the updated value when it uses that local variable.
The values associated with Out and Both Task parameters are returned to the caller irrespective of the reason for Task exit. It may be useful for applications programmer to include a status variable in the Task parameter list. That variable should then be updated by each PROIV member function as each step of the Task is completed. That way, the calling program can verify that all the required steps in the Task were executed (or not), and that the values in the returned parameters are valid (or not).
Topic ID: 540153