Beruflich Dokumente
Kultur Dokumente
VIRGIL GREEN
SYNAPTECH CONSULTING
Formal Parameters
Define interface for a function Control flow of data from function to function
Actual Parameters
Define values passed from one function to another Vary with each reference (call) to a function
VIRGIL GREEN 2 SYNAPTECH CONSULTING
- buckets of things (fields) - types and shapes of buckets - whats in the buckets? - do the things in the buckets bite? - if they bite can you get sick too? - if they dont bite, do they scream when you grab them?
VIRGIL GREEN
SYNAPTECH CONSULTING
Parameter Sets
Access by using P option on a function Up to 9 buckets (sets) can be used You can fill your bucket from
Use each set or bucket for a particular Purpose For CRT/CHG/DLTOBJ functions, the first set must contain database fields for implicit *Move all to work
VIRGIL GREEN 4 SYNAPTECH CONSULTING
Function Parameters
EDIT FUNCTION PARAMETERS MRT development model Function name. . : Clc Schedule Priority Type : Execute external function Received by file : Nomination Array: *NONE Passed ? File/*FIELD Array as Seq *Arrays Clc Sched Priority PRM FLD *Arrays Clc Sched Priority PRM FLD *FIELD Count FLD *FIELD Save Array Index Y FLD *FIELD NLK Job Lock Level FLD *FIELD Job name FLD *FIELD User FLD *FIELD Job Number FLD | Values FLD: One parameter per field RCD: One parameter for all fields KEY: One parameter for key fields only SEL: Z-Details (field selection). F3=Exit F5=Reload
VIRGIL GREEN
SYNAPTECH CONSULTING
Understanding Passed As
Determines which fields from source are available Applies to a set and describes your bucket
- big buckets; sometimes hard to put things into - smaller, specialized buckets; still hard to fill - a bucket of buckets; only one thing to a bucket - required when using *Arrays, *Field, or *None access path
Does not affect internal functions FLD is recommended for external functions
RCD, KEY
and the External function
Causes a data structure to be passed which both caller and called must map internally Data structure is always the length of the entire key or record structure whether all fields are used or not Hex problems when numeric parameters are involved and program is called from command line, menu, or CL Entire structure passed as one physical parameter ...
A B C D E F G
C
A E G Unwanted fields are ignored
VIRGIL GREEN 8
F
D
SYNAPTECH CONSULTING
VIRGIL GREEN
SYNAPTECH CONSULTING
Parameter Entries
EDIT FUNCTION PARAMETER DETAILS MRT development model Function name. . : Clc Schedule Priority Type : Execute external function Received by file : Nomination Array: Clc Sched Priority PRM Parameter (file) : *Arrays Passed as: FLD ? Field Usage Role Flag error Contract ID I NM Received Date I NM Received Time I Service Type Latest Eff Date for Nom Effective MDQ Remaining MDQ Distribute Zone Cap? Distribute Z-L Prty? Distribute Point Cap? Priority Level PT Path Type Tot Nom MMBtu Counter + SEL: Usage: I-Input, O-Output, B-Both, N-Neither, D-Drop. Role: R-Restrict, M-Map, V-Vary length, P-Position. Error: E-Flag Error. F3=Exit
VIRGIL GREEN
10
SYNAPTECH CONSULTING
Understanding Usage
Controls the direction of data flow on function calls Four different kinds of Usage:
- hears but cannot speak - speaks but cannot hear (may bite) - hears and speaks with aplomb - quiet and keeps to itself
VIRGIL GREEN
11
SYNAPTECH CONSULTING
Input
Finally, someone who will listen
For data coming into function Try to avoid using these to let the calling function direct processing in the called function Function should be able to perform based on data rather than external decisions Cannot be changed by function
VIRGIL GREEN
12
SYNAPTECH CONSULTING
Output
Just like a teenager, never listens
For data going out Function should guarantee that a value is set If on an external function, automatically initialized by the calling Synon function Cannot be referenced by function
VIRGIL GREEN
13
SYNAPTECH CONSULTING
Both
Listens and jabbers, just like a talk show host
For data going in to be modified and then returned Avoid using as an accumulator since the data (total) is really going out, not in and out Reserve these for when data is being sent into a function explicitly to be modified in some way
VIRGIL GREEN
14
SYNAPTECH CONSULTING
Neither
Never swayed by the outside world
May be used as a local variable Good choice for accumulator; better than Both Allows reference and change but calling function cannot see it Can be passed to and received from subordinate functions but higher level functions cannot change or reference value Automatically initialized to blanks or zeros Not included in implicit *Move All from PAR to DB1
A field may not be used more than once unless it is used once for input and once for output
This is not recommended because the two parameters appear to be a single parm - either a both or a neither
Output parameters on create and change object functions are automatically loaded if the parameter is a database field Calling functions should take care to not use the same actual parameter for both an input and an output formal parameter
Understanding Role
Controls how the passed value of the parameter affects functions actions Five different roles:
- leaves it just for you - gets you just what you ask for - always starting something - likes to pass the buck - used to let you break the rules
VIRGIL GREEN
17
SYNAPTECH CONSULTING
Restrictor
Keeps your function from running away
Any higher order keys must also be restrictors Limits set of data to be accessed by limiting to high order keys Used on all function types except messages, Excintfun, Excextfun, and Excusrsrc If high order key is also foreign key, causes relation to be validated before screen is displayed. Allows display of virtual fields without having them on the based-on access path
Positioner
A nice way to start something
Any higher order keys must be restrictors or positioners Allows you to start at a certain position in the index
There is nothing available to stop processing Used on Rtvobj, Prtfil, and Prtobj Multiple positioners allow starting point within multiple continuous variables
Mapped
Helps data find its way to the screen
Used only on *External functions with screens Moves data from parameter to screen field Places field on screen if not already there
In Control record for Edtfil, Edttrn, Dspfil, and Dsptrn In Detail record for Pmtrcd, Edtrcd, and Dsprcd Neither Mapped parms allow database fields that are not on based-on access path to be placed on screen
VIRGIL GREEN
20
SYNAPTECH CONSULTING
Vary
Lets you get by with just about anything
Turns off domain checking but still requires character/numeric compatibility Not necessary since release 4.0, but recommended Only valid for Excusrsrc, Excusrpgm, Excextfun, and Error messages Allows easier integration with non-Synon programs Useful for including field value in generic error messages
By default error flagging is on Error checking prone to change can be externalized Turn off to include screen field in error message without turning on fields error attribute
Passing by value protects the data in the calling function from possible failures in called function which could leave a set of values partially changed
23 SYNAPTECH CONSULTING
VIRGIL GREEN
VIRGIL GREEN
24
SYNAPTECH CONSULTING
VIRGIL GREEN
25
SYNAPTECH CONSULTING
VIRGIL GREEN
27
SYNAPTECH CONSULTING