The GETPUT operator has two forms, depending on its location:
GETPUT( In1, Out, DoIt, 'VariableName') - used in a subnet
GETPUT( In1, Out, DoIt, {Variable}) - used in the main
network
GETPUT( In1, Out, DoIt, {Variable}, Default) - a default
value when variable is unknown
The operator requires either searching on its value pin or a value pushed in on DoIt to begin operation. A True state coming in on DoIt will cause the value of the variable to be pushed out on Out. A value pushed in on In will cause the value of the variable to be updated. Resetting of the state of DoIt, that is resetting to NYK and back to True again, will cause the cycle to be repeated. GETPUT can be used within the scope of a FORNEST loop, responding to the value of the index variable I, and handling a statement like
A = A + 1
(which is not possible in a network) and transforming it into
NewA = OldA + 1
GETPUT(NewA, OldA, I, {A})
As an example of use in a subnet, MarketValue is calculated, and then used to update HighestMarketValue, if appropriate.
IF MarketValue > OldHighestMarketValue
THEN NewHighestMarketValue = MarketValue
There is only one HighestMarketValue variable, so the GETPUT operator is used, as
GETPUT(NewHighestMarketValue,OldHighestMarketValue,MarketValue,'HighestMarketValue')
When a value of MarketValue is found, it is pushed into the GETPUT operator, which finds the HighestMarketValue variable and pushes its value out on OldHighestMarketValue. This activates the statement "IF Market Value...", and if the condition is met, the value for NewHighestMarketValue is pushed into the GETPUT, updating the value of the HighestMarketValue variable (the value of OldHighestmarketValue is not affected). If the condition is not met, no updating occurs, as GETPUT does not see a value pushed in (this means that UKE is a valid retiurn state from searching its In pin).
The parameters
In1 - Can be of any type.
Out - Can be of any type.
DoIt - Can be of any type - must have a state of True to activate the
operator.
'VariableName' - string resolves to name of variable which is to be found on
this invocation of the subnet
List% - List has one member, which is a variable to be updated.
Default - is used as a value for Out if variable has no value
GETPUT is a logical state propagation version of what a program does with its Fetch and Store operations, and is of particular use in a dataflow environment.
See