Caché ObjectScript Reference
$ZNEXT (legacy function)
[Back] [Next]
   
Server:docs2
Instance:LATEST
User:UnknownUser
 
-
Go to:
Search:    

Returns a full reference to the next array node.
Synopsis
$ZNEXT(global-reference)
Parameter
global-reference A subscripted global array node. The subscript is required because it provides the starting point. You cannot specify just the array name.
Description
This page describes the legacy function $ZNEXT. It is described here for compatibility with legacy applications. $ZNEXT is similar to the $QUERY function, except that $ZNEXT uses “–1” as the starting point and failure code, while $QUERY uses the null string (""). The $QUERY function should be used for new applications.
$ZNEXT returns a full reference to the array node defined next in the collating sequence after the specified array node. $ZNEXT accepts a naked global reference. For further details, see Naked Global Reference in Using Caché Globals.
Examples
The following example uses $ZNEXT to list the subscripts of a global:
   ZNSPACE "samples"
   SET x=^CinemaooFilmCategoryI(-1)
Loop
   SET a=$ZNEXT(x)
   IF a=-1 {
           WRITE !,"All done"
           QUIT }
   ELSE { 
        SET x=a
        WRITE !,a
        GOTO Loop }
 
The following example uses $QUERY to list the subscripts of a global:
   ZNSPACE "samples"
   SET x=^CinemaooFilmCategoryI("")
Loop
   SET a=$QUERY(x)
   IF a="" {
           WRITE !,"All done"
           QUIT }
   ELSE { 
        SET x=a
        WRITE !,a
        GOTO Loop }
 
See Also