Progress
Programming
Handbook


Record Reading

The FOR EACH block is the only block statement that automatically reads records each time it iterates. The following examples demonstrate this:

p-bkchp4.p
/* This FOR EACH block reads the records from the customer 
   table one at a time, processing the statements in the  
   block for each of those records.                       */ 
FOR EACH customer: 
  DISPLAY customer WITH 2 COLUMNS. 
END. 

You can be more specific about which records you want to read by using a record phrase in the FOR EACH block header:

p-bkchp5.p
/* The record-spec (made up of a simple WHERE phrase in 
   this example) tells the FOR EACH block to read only 
   those records from the customer file that have a 
   credit-limit greater than 50,000. */ 
FOR EACH customer WHERE credit-limit > 50000: 
    DISPLAY customer WITH 2 COLUMNS. 
END. 


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095