Difference between revisions of "BEGIN SEQUENCE"

From Recital Documentation Wiki
Jump to: navigation, search
 
(Products)
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
=BEGIN SEQUENCE=
 
 
 
==Class==
 
Error Handling and Debugging
 
 
 
 
==Purpose==
 
==Purpose==
 
Start error-handling block
 
Start error-handling block
Line 37: Line 30:
 
error = .F.
 
error = .F.
 
begin sequence
 
begin sequence
 +
 
do while not eof()
 
do while not eof()
  if empty(name)
+
    if empty(name)
    rec = recno()
+
        rec = recno()
    error = .T.
+
        error = .T.
    break
+
        break
  else
+
    else
    display name
+
        display name
  endif
+
    endif
  skip
+
    skip
 
enddo
 
enddo
 +
 
end sequence
 
end sequence
 +
 
if error
 
if error
  set message to "Error: No name in record; &rec."
+
    set message to "Error: No name in record; &rec."
 
else
 
else
  set message to "End of file reached."
+
    set message to "End of file reached."
 
endif
 
endif
 
</code>
 
</code>
Line 57: Line 53:
  
 
==Products==
 
==Products==
Recital Database Server, Recital Mirage Server, Recital Terminal Developer
+
Recital Server, Recital  
 
[[Category:Documentation]]
 
[[Category:Documentation]]
 
[[Category:Commands]]
 
[[Category:Commands]]
 +
[[Category:Error Handling and Debugging]]
 +
[[Category:Error Handling and Debugging Commands]]

Latest revision as of 14:35, 10 November 2009

Purpose

Start error-handling block


Syntax

BEGIN SEQUENCE

<command>

[BREAK]

<command>

END SEQUENCE


See Also

ON ERROR


Description

The main purpose of the BEGIN SEQUENCE ... BREAK ... END SEQUENCE construct is to allow for programmable error handling. The commands that follow the END SEQUENCE command will normally be devoted to error handling and will be executed immediately.

BREAK

The BREAK keyword can be used whenever the program commands detect an error. For this purpose, BREAK may appear at any depth within nested procedures. When BREAK is encountered, all stacked procedures will unwind automatically.


Example

error = .F.
begin sequence
 
do while not eof()
    if empty(name)
        rec = recno()
        error = .T.
        break
    else
        display name
    endif
    skip
enddo
 
end sequence
 
if error
    set message to "Error: No name in record; &rec."
else
    set message to "End of file reached."
endif


Products

Recital Server, Recital