Progress
Programming
Handbook
Program Structure in a Procedure-driven Program
The basic structure of a procedure-driven program is as follows.
The following example of a simple procedure-driven program using a FOR EACH loop illustrates this structure:
These notes help explain the code:
- The FOR EACH statement starts an iterating block and finds one customer record in the database on each iteration.
- The DISPLAY statement moves the customer data from the database to the screen buffer and displays six occurrences of the Cust-Num, Name, and Phone fields in an unnamed default frame.
- The PROMPT-FOR statement requests user input for the Phone field and then places it in the screen buffer.
- The IF . . . THEN statement includes an INPUT statement and a DO block. The code instructs Progress to compare the current value in the Phone field to its value in the database. If the two values are not the same, Progress displays the message “Phone Number changed”, the terminal beeps, and program execution drops down to the next line, the ASSIGN statement. If the two values are identical, Progress skips the DO block and moves directly to the ASSIGN statement.
- The ASSIGN statement instructs Progress to move the new Phone data into the database.
- When all the customer records have been read, the program ends.
Copyright © 2004 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |