Difference between revisions of "SCAN"

From Recital Documentation Wiki
Jump to: navigation, search
 
(Description)
 
(10 intermediate revisions by 3 users not shown)
Line 1: Line 1:
=SCAN=
 
 
 
==Class==
 
Applications
 
  
  
 
==Purpose==
 
==Purpose==
Perform list of commands interactively
+
Scans over records in a table and executes a command block for each selected record.
 
+
  
 
==Syntax==
 
==Syntax==
Line 25: Line 19:
  
 
==Description==
 
==Description==
The SCAN ... ENDSCAN command executes a list of commands repeatedly for a specified selection of records while an optionally specified condition is true, or until an EXIT is encountered.  The optional LOOP keyword forces control to the beginning of the SCAN.
+
The SCAN ... ENDSCAN command executes a command block repeatedly FOR a specified selection of records WHILE an optionally specified condition is true, or until an EXIT is encountered.  The optional LOOP keyword forces control to the beginning of the SCAN.
  
 
The SCAN...ENDSCAN command can be used to reduce the programming involved in a LOCATE ... DO WHILE ... CONTINUE construct.
 
The SCAN...ENDSCAN command can be used to reduce the programming involved in a LOCATE ... DO WHILE ... CONTINUE construct.
 
  
 
==Example==
 
==Example==
 
<code lang="recital">
 
<code lang="recital">
scan all for code = "HMT"
+
use customers
display name, address
+
seek "HMT"
 +
scan rest while code = "HMT"
 +
    echo "name=" + name + "address=" + address
 
endscan
 
endscan
 
</code>
 
</code>
 
  
 
==Products==
 
==Products==
Line 42: Line 36:
 
[[Category:Documentation]]
 
[[Category:Documentation]]
 
[[Category:Commands]]
 
[[Category:Commands]]
 +
[[Category:Table Basics]]
 +
[[Category:Table Basics Commands]]
 +
[[Category:Data Commands]]

Latest revision as of 07:43, 20 June 2010


Purpose

Scans over records in a table and executes a command block for each selected record.

Syntax

SCAN [<scope>] [FOR <condition>] [WHILE <condition>]

[EXIT]

[LOOP]

ENDSCAN


See Also

CONTINUE, DO WHILE, IF, LOCATE


Description

The SCAN ... ENDSCAN command executes a command block repeatedly FOR a specified selection of records WHILE an optionally specified condition is true, or until an EXIT is encountered. The optional LOOP keyword forces control to the beginning of the SCAN.

The SCAN...ENDSCAN command can be used to reduce the programming involved in a LOCATE ... DO WHILE ... CONTINUE construct.

Example

use customers
seek "HMT"
scan rest while code = "HMT"
    echo "name=" + name + "address=" + address
endscan

Products

Recital Database Server, Recital Mirage Server, Recital Terminal Developer