Previous Topic: WITHIN SETNext Topic: DB-KEY and ACCEPT


WITHIN AREA

User programs can also navigate the database based on the physical location of records in the area. The FIND/OBTAIN WITHIN AREA function provides the following options for this purpose:

The process of consecutively accessing records in an area is called an area sweep.

In an area that contains multiple record types, records can be located independently of type, or the function can be limited to records of a specific type.

The FIND/OBTAIN WITHIN AREA function is often the most efficient means of accessing all records of a particular type since each page is processed only once.

For example, we can produce complete reports of all employees like this:

OBTAIN FIRST EMPLOYEE WITHIN EMP-DEMO-REGION.
PERFORM REPORT-WRITER.
    ...
Repeat until end of area is reached:
       OBTAIN NEXT EMPLOYEE WITHIN EMP-DEMO-REGION.
       PERFORM REPORT WRITER.

The following figure illustrates various OBTAIN WITHIN AREA functions: