The following ABL constructs generate query information logging:

  • FOR [ EACH | FIRST | LAST ] statements:
    
    FOR EACH customer
    
  • Static PRESELECT statement on REPEAT or DO blocks:
    
    REPEAT PRESELECT FOR EACH customer, EACH order OF CUSTOMER 
    
  • Statically Opened Queries:
    
    OPEN QUERY q FOR EACH customer
    
  • Dynamically Opened Queries

    It is possible to dynamically open both dynamic and static queries:

    • For a dynamic query object:
      
      DEFINE VARIABLE qh AS HANDLE NO-UNDO.
      CREATE QUERY qh.
      . . .
      qh:QUERY-PREPARE("FOR EACH customer").
      qh:QUERY-OPEN().
      
    • For a static query object:
      
      DEFINE VARIABLE qh AS HANDLE NO-UNDO.
      DEFINE QUERY q FOR CUSTOMER.
      qh = q:HANDLE.
      qh:QUERY-PREPARE("FOR EACH customer").
      qh:QUERY-OPEN().
      
  • AGGREGATE statement:
    AGGREGATE totalBalance = TOTAL(Balance) FOR Customer
      WHERE Country EQ 'USA' AND City EQ 'Boston'.

Query information logging logs information separately for each instance of the same query. For example, if a program containing a query calls itself recursively, information is logged for each instance of the query.