As a small digression, it is necessary to explain a couple of statements in this example that you have not seen before. They illustrate one of the key characteristics of queries: there is no built-in block scoping or iteration in a query. First, here is the new phrase on the DISPLAY statement:

    WITH FRAME CustFrame 15 DOWN.

You learned a little about down frames in Use Basic ABL Constructs. A down frame is a frame that can display more than one row of data, each showing the same fields for a different record in a report-like format. In the examples you wrote in earlier chapters, you did not have to specify the DOWN phrase to indicate the number of rows to give the frame. The AVM gave you a down frame with a default number of rows automatically.

Why is it not done in this case? Because a query is not associated with a particular block, and does not have any automatic iteration, the AVM does not know how the data is going to be displayed. So by default, it just gives you a one down frame that displays a single record.

The second new piece of syntax is this statement at the end of the block:

Syntax

DOWN WITH FRAME CustFrame.

No, this is not a political protest slogan! Rather, it tells the AVM to display a row in the frame CustFrame, and then to position down a row in the frame before displaying the next row. If you do not use this statement, then even if you define the frame to be 15 DOWN, all the rows are displayed on top of each other on the first row of the frame. Once again, this is because the AVM does not know how you are going to display the data. It does not associate iteration through a result set with your DO block automatically, as it would with a FOR EACH block. Therefore, you have to tell it what to do.