Altova XMLSpy 2024 Enterprise Edition

The following example shows subroutine declaration and invocation.

 

[create \$outputpath & \$module & "output.txt"

 

' define sub SimpleSub()

Sub SimpleSub()        

]SimpleSub() called                        

[endsub

 

' execute sub SimpleSub()

Call SimpleSub()

 

\$ParamByValue        = "Original Value"

]ParamByValue        = [=\$ParamByValue]

[\$ParamByRef        = "Original Value"

]ParamByRef        = [=\$ParamByRef]

 

' define sub CompleteSub()

[Sub CompleteSub( \$param, ByVal \$paramByValue, ByRef \$paramByRef )

]CompleteSub called.

 param = [=\$param]

 paramByValue = [=\$paramByValue]

 paramByRef = [=\$paramByRef]

[\$ParamByRef = "Local Variable"

\$paramByValue = "new value"

\$paramByRef = "new value"

]        Set values inside Sub

[\$ParamByRef = "Local Variable"

\$paramByValue = "new value"

\$paramByRef = "new value"

]CompleteSub finished.

[endsub

 

' run sub CompleteSub()

Call CompleteSub( "FirstParameter", \$ParamByValue, \$ParamByRef )

]

ParamByValue=[=\$ParamByValue]

ParamByRef=[=\$ParamByRef]

[

Close

]

© 2017-2023 Altova GmbH