A list function that indicates whether the specified element exists and has a data value.
Examples
The following Embedded SQL examples show the results of the various values of the position argument.
All of the following $LISTDATA statements return a value of 1:
KILL Y
SET a=$LISTBUILD("Red",,Y,"","Green")
&sql(SELECT $LISTDATA(:a), $LISTDATA(:a,1),
$LISTDATA(:a,4), $LISTDATA(:a,5), $LISTDATA(:a,-1)
INTO :b,:c, :d, :e, :f)
IF SQLCODE'=0 {
WRITE !,"Error code ",SQLCODE }
ELSE {
WRITE !,"1st element status ",b ; 1st element default
WRITE !,"1st element status ",c ; 1st element specified
WRITE !,"4th element status ",d ; 4th element null string
WRITE !,"5th element status ",e ; 5th element in 5-element list
WRITE !,"last element status ",f ; last element in 5-element list
}
The following $LISTDATA statements return a value of 0 for the same five-element list:
KILL Y
SET a=$LISTBUILD("Red",,Y,"","Green")
&sql(SELECT $LISTDATA(:a,2), $LISTDATA(:a,3),
$LISTDATA(:a,0), $LISTDATA(:a,6)
INTO :b,:c, :d, :e)
IF SQLCODE'=0 {
WRITE !,"Error code ",SQLCODE }
ELSE {
WRITE !,"2nd element status ",b ; 2nd element is undefined
WRITE !,"3rd element status ",c ; 3rd element is killed variable
WRITE !,"0th element status ",d ; zero position nonexistent
WRITE !,"6th element status ",e ; 6th element in 5-element list
}