Was this helpful?
Endloop
Exits from a submenu and returns to the previous menu, or terminates a select, unloadtable or while loop, or a run submenu or display submenu statement.
Syntax
endloop [label]
label
Specifies an unquoted character string indicating which nested loop to end. It cannot be a field name or a keyword.
Description
The 4GL endloop statement can be used to break out of various sorts of loops. When used within a submenu created by an attached query or a run or display submenu statement, the endloop statement causes the application to exit from the submenu and return to the main menu of a frame. At the same time, endloop closes the attached query for the submenu.
Used within a select or while statement, endloop causes processing within the loop to terminate, transferring control to the first statement following endwhile or end. This is the only form of endloop that can optionally take a label as a parameter.
The label is useful within a nested series of while statements, to indicate which level of nesting to break out of. An endloop with a label causes control to break to the first statement following the endwhile for the labeled loop. See the while statement section for more information on labeled loops.
You can use the endloop statement to break out of an unloadtable loop without completing the processing of every row in the data set.
For additional information, see the sections in this chapter on the Selectunloadtable Statement--Loop Through Rows and Execute Statements on page 184WhileRun Submenu, and Display Submenu statements.
Examples
The End menu operation closes the submenu and its attached query:
'End' = 
begin 
  endloop; 
end
Break out of the while loop labeled B:
endloop B;
Last modified date: 04/03/2024