Function Contexts
PAR
The Parameter (PAR) context contains the fields that you define as parameters for the current function.
This includes the function whose action diagram you are currently editing.
You can specify function parameters using the Edit Function Parameters panel.
When you define a field as a function parameter, Synon automatically adds the field to the PAR context of the function, but availability of the fields associated with the PAR context is user-point dependent.
If you define parameters for a particular function, then the PAR context is available at all points in the action diagram of that function. Consider the following example.
If you create an Edit Record function on a Customer file, you could specify Company Code as an input parameter and Company Name as an output parameter:
The Company Code could then be used as an input field and the Company Name as an output field, at appropriate places in an action diagram. For example:
CTL. Company code = PAR. Company code <<<
PAR. Company name = DTL. Company name <<<
WRK
The Work (WRK) context contains program variables not described by any other context. Work context fields are useful to contain work variables for interim calculations or for assigning work data or strings in interim processing.
You can use any field in the data dictionary as a work field.
You can add other user-defined fields to the WRK context by adding them to the data dictionary using the Define Objects panel.
The WRK context is available at all points in the action diagram of all function types.
WRK context variables are global to the external function and so can be changed at any point by any function.
As shown in the above example of two external functions, if you include internal functions within an external function an umbrella effect allows the internal and the external function to share the same work field.
Consequently, any changes to that external function’s work field could cause changes to the internal functions.
This means that any actions or functions within the external function can change any WRK variable without being passed as a parameter.
You should only use WRK variables when there are no intervening function calls that could change the values.
For example, you could use a work field to keep a count of the number of records processed:
WRK. Counter = WRK. Counter + CON.1 <<<