Local Variables
Local variables are private for each PSL process and are initialized at the start of the process. The types of local variables are:
- Named - A name is assigned to the variable by the programmer.
- Unnamed - A name is not provided, and the PATROL agent assigns one.
Named Variables
In a named variable, the PATROL agent creates a variable author and assigns it the value John Doe. The agent then executes the function nthargf(author,1) and assigns the result to a second variable named firstname. The result is that two named local variables are created. Below is an example:
author="John Doe"; firstname=nthargf(author,1);
Unnamed Variables
In an unnamed variable, the PATROL agent automatically assigns a name because the programmer does not provide a name. Below is an example:
firstline =nthline(cat(my le),1);
In this example, because a name was not provided for the subfunction cat(error file), PATROL assigns it a name. The former example expands to the following:
unnamed var=cat(myfile); firstline =nthline(unnamed var,1);
This means that the output of every command is stored inside a variable (named or unnamed).