Danaher Motion
06/2005
Appendix B
M-SS-005-03 Rev
E
189
A function can return a structure variable like any other data type. For example:
Dim Shared A as X
Program
Dim S1 as X
S1 = MyFunc(1)
End Program
Function MyFunc(i1 as long) as X
MyFunc->Type = 1
End Function
Query
You cannot query a whole structure or you receive a translation error.
?<
variable_name
> - gives a translation error
S
INGLE
E
LEMENT
Q
UERY
Syntax for querying a single element of a structure:
?<
variable_name
>-><
structure element
>
For example:
Common shared s1 as X 'declaration of a default structure
S1->.Type =1
S1->Length =2
?S1 'Translation Error
?S1->Type
Operators
You cannot use operators with structures. It is possible to use operators for the single
elements of the structure.
Pass Structure
A structure can be passed by value and reference like any other data type.
Example1
Program
Dim s1 as X
Call Sub1(S1)
?S1->Type
End program
Sub Sub1(X as X)
X ->Type= 1
End Sub
Example2
Program
Dim s1 as X
Call Sub1(S1)
?S1->Type
End program
Sub Sub1(X as X)
X ->Type= 1
End Sub