Welcome to jBASE's new documentation site! Many answers to your questions can be found by searching the Knowledgebase or viewing the jBASE Documentation. We also have a Google Group for peer discussion about jBASE. If you are unable to find the information you are looking for, jBASE Support will be glad to assist in resolving your technical problems. Enjoy and please provide comments and feedback .

How can we help you?



READNEXT retrieves the next element in a list variable. It takes the general form: 

READNEXT variable1, variable2 {FROM variable3} {SETTING setvar} {THEN|ELSE statements}


  • variable1 is the variable into which the next element of the list will be read. 
  • variable2 is used when the list has been retrieved externally from a SSELECT or similar jBASE command that has used an exploding sort directive. When specified, this variable will be set to the multi-value reference of the current element. For example, if the SSELECT used a BY-EXP directive on field 3 of the records in a file, the list will contain each record key in the file as many times as there are multi-values in the field. Each READNEXT instance will set variable2 to the multi-value in field 3 to which the element refers. This allows the multi-values in field 3 to be retrieved in sorted order.
  • If variable3 is specified with the FROM clause, the READNEXT operates on the list contained in variable3. If variable3 is not specified, the default select list variable will be assumed.

If the SETTING clause is specified and the read (to build the next portion of the list) fails, setvar will be set to one of these values.


READNEXT can be used as an expression returning a Boolean TRUE or FALSE value. If an element is successfully read from the list, TRUE is returned. If the list was empty, FALSE is returned.

An example of use is as: 


See also: SELECT

Go back to jBASE BASIC

Was this article helpful?