Is it possible to pass an array as a parameter for a function in d3 pick? I have tried doing that and it seems to generate an error message:
B14 Bad Stack Descriptor
The error message appears if you try to pass an array as a parameter for a function. This leads me to two questions.
1) Is it is even possible to pass an array as a parameter in d3 pick?
2) If it is not possible to pass an array directly, is there some kind of workaround that will allow one to achieve the same result?
The terminology in the question is a bit ambiguous but try this:
DIM ARRAY(5)
ARRAY(1) = "FOO"
CALL MYSUB( ARRAY )
CRT ARRAY(1) ; * should be BAR
END
And in the called item:
SUBROUTINE MYSUB( MYARRAY )
DIM MYARRAY()
MYARRAY(1) = "BAR"
RETURN
Another solution to this is to pass it indirectly through Common: COMMON ARRAY(5) ARRAY(1) = "FOO" CALL MYSUB CRT ARRAY(1) ; * should be BAR END
And in the called item:
SUBROUTINE MYSUB
COMMON MYARRAY(5) ; * need to agree
MYARRAY(1) = "BAR"
RETURN
To avoid the need to have each program know how many elements are required, put that code in an Include item:
Include item APP.COMMON:
COMMON ARRAY(5)
* nothing else here unless you have other things going on
Mainline code:
INCLUDE APP.COMMON
ARRAY(1) = "FOO"
CALL MYSUB
CRT ARRAY(1) ; * should be BAR
END
And in the called item:
SUBROUTINE MYSUB
INCLUDE APP.COMMON
ARRAY(1) = "BAR" ; * need to use same variable declared in the include item
RETURN