[CLOSE] LOOP [(r)]
|
This document covers the following topics:
For an explanation of the symbols used in the syntax diagram, see Syntax Symbols.
Belongs to Function Group: Reporting Mode Statements
The LOOP statement is used to close a processing loop. It causes processing
of the current pass through the loop to be terminated and control to be returned to the
beginning of the processing loop.
When the processing loop for which the LOOP statement is issued is
terminated (that is, when all records have been processed or iterations have been
performed), execution continues with the statement after the LOOP
statement.
The LOOP statement is used with the following statements: CALL FILE, CALL LOOP, FIND, FOR,
HISTOGRAM, PARSE JSON, PARSE XML, READ, READLOB, READ RESULT SET (SQL), READ WORK FILE, REPEAT, SELECT (SQL), SORT, UPLOAD PC FILE.
A LOOP statement, in addition to closing a processing loop, will eliminate
all field references to FIND,
FIND FIRST, FIND UNIQUE, READ and GET statements contained within the loop.
A field within a view may be referenced outside the processing loop by using the view name as a qualifier.
This statement is for reporting mode only.
A LOOP statement may not be specified based on a conditional statement
such as IF or AT BREAK.
| Syntax Element | Description |
|---|---|
LOOP (r)
|
Statement Reference Notation:
The |
Notes:
LOOP statement, will be closed
automatically by an END
statement.
LOOP statement. But with respect to good coding
practice, you are not recommended to do so.
FIND ...
READ ...
READ ...
LOOP (0010) /* closes all loops
FIND ...
READ ...
READ ...
LOOP /* closes loop initiated on line 0030
LOOP /* closes loop initiated on line 0020
LOOP /* closes loop initiated on line 0010