ESCAPE
|
|
TOP
[REPOSITION]
|
|
BOTTOM
[(r)] [IMMEDIATE]
|
|||
ROUTINE
[IMMEDIATE]
|
|||
MODULE
[IMMEDIATE]
|
ESCAPE
|
|
TOP
[REPOSITION]
|
|
||
BOTTOM
[(r)] [IMMEDIATE]
|
|||||
ROUTINE
[IMMEDIATE]
|
|||||
MODULE
[IMMEDIATE]
|
|||||
This document covers the following topics:
For an explanation of the symbols used in the syntax diagram, see Syntax Symbols.
Related Statements:
FIND | FOR | HISTOGRAM | PARSE
JSON | PARSE
XML | READ |
READ RESULT SET
(SQL)| READ WORK
FILE | READLOB
| REPEAT | SORT
CALL | CALL FILE | CALL
LOOP | CALLNAT | DEFINE
SUBROUTINE | FETCH | PERFORM
Belongs to Function Group:
The ESCAPE statement is used to interrupt the linear flow of execution of a
processing loop or a routine.
With the keywords TOP, BOTTOM and ROUTINE you
indicate where processing is to continue when the ESCAPE statement is
encountered.
An ESCAPE TOP/BOTTOM statement, when encountered for processing, will
internally refer to the innermost active processing loop. The ESCAPE
statement need not be physically placed within the processing loop.
If an ESCAPE TOP/BOTTOM statement is placed in a routine (subroutine,
subprogram, function, or a program invoked with FETCH RETURN), the routine(s)
entered during execution of the processing loop will be terminated automatically.
More than one ESCAPE statement may be contained within the same processing
loop.
The execution of an ESCAPE statement may be based on a logical condition.
If an ESCAPE statement is encountered during processing of an AT END
OF DATA, AT BREAK or AT END OF PAGE block, the
execution of the special condition block will be terminated and ESCAPE
processing will continue as required.
If an ESCAPE statement is encountered during processing of an
if-no-records-found condition, no loop-end processing will be performed (equivalent to
ESCAPE IMMEDIATE).
| Syntax Element | Description |
|---|---|
ESCAPE TOP
|
Top Option:
|
REPOSITION
|
Top Reposition Option:
When an At the same time,
|
ESCAPE BOTTOM
|
Bottom Option:
In reporting mode, |
(r) |
Statement Reference:
Notation
A label or a reference number can only be specified if the |
IMMEDIATE
|
Immediate Option:
If you specify the keyword |
ESCAPE ROUTINE
|
Routine Option:
This option indicates that the current Natural routine, which may have been
invoked via a In the case of a subroutine, processing will continue with the first statement after the statement used to invoke the subroutine. In the case of a main program, Natural command mode will be entered. All loops currently active within the routine will be terminated and loop-end
processing performed as well as final processing for user-initiated
( |
ESCAPE MODULE
|
Module Option:
This option indicates that the entire current program level, with all internal
subroutines, is to relinquish control. The control is then returned to the
object of the former program level. If
As with |
** Example 'ESCEX1': ESCAPE
************************************************************************
DEFINE DATA LOCAL
1 EMPLOY-VIEW VIEW OF EMPLOYEES
2 CITY
2 FIRST-NAME
2 NAME
2 AREA-CODE
2 PHONE
*
1 #CITY (A20) INIT <' '>
1 #CNTL (A1) INIT <' '>
END-DEFINE
*
REPEAT
INPUT 'ENTER VALUE FOR CITY: ' #CITY
/ 'OR ''.'' TO TERMINATE '
IF #CITY = '.'
ESCAPE BOTTOM
END-IF
/*
FND. FIND EMPLOY-VIEW WITH CITY = #CITY
/*
IF NO RECORDS FOUND
WRITE 'NO RECORDS FOUND'
ESCAPE BOTTOM (FND.)
END-NOREC
AT START OF DATA
INPUT (AD=O) 'RECORDS FOUND:' *NUMBER //
'ENTER ''D'' TO DISPLAY RECORDS' #CNTL (AD=M)
IF #CNTL NE 'D'
ESCAPE BOTTOM (FND.)
END-IF
END-START
/*
DISPLAY NOTITLE NAME FIRST-NAME PHONE
END-FIND
END-REPEAT
ENTER VALUE FOR CITY: PARIS (OR '.' TO TERMINATE)
RECORDS FOUND: 26 ENTER 'D' TO DISPLAY RECORDS D
NAME FIRST-NAME TELEPHONE
-------------------- -------------------- ---------------
MAIZIERE ELISABETH 46758304
MARX JEAN-MARIE 40738871
REIGNARD JACQUELINE 48472153
RENAUD MICHEL 46055008
REMOUE GERMAINE 36929371
LAVENDA SALOMON 40155905
BROUSSE GUY 37502323
GIORDA LOUIS 37497316
SIECA FRANCOIS 40487413
CENSIER BERNARD 38070268
DUC JEAN-PAUL 38065261
CAHN RAYMOND 43723961
MAZUY ROBERT 44286899
FAURIE HENRI 44341159
VALLY ALAIN 47326249
BRETON JEAN-MARIE 48467146
GIGLEUX JACQUES 40477399
KORAB-BRZOZOWSKI BOGDAN 45288048
XOLIN CHRISTIAN 46060015
LEGRIS ROGER 39341509
VVVV