

Designing Functions › Function Parameters › Understanding Parameter Usage and Role
Understanding Parameter Usage and Role
You need to assign a usage and role for each parameter to direct the calling and called functions to use the parameter in a particular way.
- Parameter Usage—A parameter’s usage determines how the parameter is to be received from or returned to the calling function. The four possible usages are Input only, Output only, Both, and Neither. In this tutorial you will use only the first two usages:
- Input only—A value for the parameter is passed to the called function. The called function returns the value to the calling function without changing it.
- Output only—The called function returns a value for the parameter to the calling function when the called function ends.
- Parameter Role—The role of a function parameter specifies how the parameter will be used in the called function. The four possible roles are Map, Restrictor, Positioner, and Vary. In this tutorial you will use only the Restrictor role.
The Restrictor role is used to restrict which records from a database file will be displayed, changed, or printed by the called function. A Restrictor parameter must be a key field on the access path to which the called function attaches. If there are multiple keys, the parameter sequence must match the key sequence.
You will specify the Restrictor role for the Horse code parameter to restrict the Display Racing results function to show only race entries for a particular horse. In other words, the function can only process database records whose keys match the Horse code parameter.
Copyright © 2014 CA Technologies.
All rights reserved.
 
|
|