Altova MapForce 2022 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

]

© 2016-2022 Altova GmbH