# Bind the Dynstruct to a Variable
> [HTML Version](bindthedynstruct.htm)
_Updated March 2025_
The binding operation associates a dynamic structure definition with a DYNSTRUCT variable, accomplished via one of the following methods.
map1 ds, DYNSTRUCT \! sample dynamic struct (used below)
map1 stvar, ST\_SOME\_STRUCT \! sample defstruct " "
map1 bar, ST\_ANOTHER\_STRUCT \! another sample defstruct " "
• Explicit binding via [MX\_DYNSTRUCT](mx_dynstruct.htm.md):
xcall MIAMEX, MX\_DYNSTRUCT, DYNOP\_BIND, status, dsname\$, ds
• Explicit binding via .[BINDSTRUCT](bindstruct.htm.md):
.BINDSTRUCT ds, stvar
• Implicit DYNSTRUCT by passing an instance of a defined structure to a function which receives it as a DYNSTRUCT:
call Fn'Dive(ds=bar) \! ST\_ANOTHER\_STRUCT will be embedded (because of how Fn'Dive receives it))
...
function Fn'Dive(ds as DYNSTRUCT)
Implicit binding works even for parameters defined with the :OUTPUTONLY qualifier. The received DYNSTRUCT variable will be empty regardless of the default value, if any, but will be bound. For example:
defstruct st\_cust
map2 id,b,4
map2 name,s,30
endstruct
map1 cust, st\_cust
cust.id = 99
cust.name = "Jacob"
call fn'foo(ds=cust)
? cust.name \! will be "Finkleheimer"
end
function fn'foo(ds="" as dynstruct:outputonly)
? ds.name \! will be "" because of :outputonly
ds.name = "Finkleheimer" \! valid because ds auto-bound to st\_cust
xputarg @ds
endfunction
**See Also**
• [Structure Definition Embedding](structuredefinitionembedding.htm.md)
**History**
2025 March, A-Shell 7.0.1770.0, compiler edit 1064: The :OUTPUTONLY qualifier no longer disables implicit binding. Prior to this update, the references to ds.name inside the function would have generated error 70 (invalid dynstruct reference) because the :outputonly would have defeated the automatic binding.