Local variables are retrieved in alphabetical order. Database variables are retrieved by generation, from the most recent to the oldest.
If startVar is blank, NEXTVAR returns the name of the first variable in the set.
If startVar is the name of a variable in the set, NEXTVAR returns the name of the next variable in the set. For committed Database variables, the generation is appended to the name.
If startVar is the name of the last variable in the set, NEXTVAR returns a blank and the SYSRC System variable is set to 4.
Mask characters are supported for Local variable names in varset. varset may contain an asterisk * (that represents any number of characters) or a question mark ? (that represents a single character).
Mask characters are not supported for Database variables in varset.
Uncommitted Database variables that belong to the set are returned before committed Database variables in the same set.