Progress
Programming
Handbook


Example Procedures

The following examples show how Progress allocates different kinds of frames to different kinds of blocks.

In the procedure p-frm7.p, Progress allocates a down frame to the outer FOR EACH block. The inner FOR EACH block does not display data, so Progress does not allocate a frame to it, and therefore no frame is scoped to it:

p-frm7.p
DEFINE VARIABLE cnt AS INTEGER INITIAL 0.

FOR EACH customer:
  DISPLAY cust-num name.
  FOR EACH order OF customer:
    cnt = cnt + 1.
  END.
  DISPLAY cnt LABEL "Total Orders".
  cnt = 0.
END. 

In the procedure p-frm8.p, Progress allocates a one-down frame to the outer FOR EACH block, a one-down frame to inner FOR EACH block, and a one-down frame to the DO WITH FRAME block. The DO WITH FRAME block has a frame scoped to it, so the inner FOR EACH block does not receive a down frame:

p-frm8.p
FOR EACH customer:
    DISPLAY cust-num name.
    FOR EACH order of customer:
        DISPLAY order-num.
        DO WITH FRAME a:
            FIND FIRST order-line OF order.
            DISPLAY item-num.
        END.
    END.
END. 

In the procedure p-frm9.p, Progress allocates two one-down frames to the procedure block (an unnamed frame and frame aaa). Although frame aaa is the default frame for the REPEAT block, it is not scoped to the REPEAT block. Therefore, it is a one-down frame:

p-frm9.p
DISPLAY "Customer Report".

FORM customer.cust-num customer.name WITH FRAME aaa.

REPEAT WITH FRAME aaa:
  FIND NEXT customer.
  UPDATE cust-num name.
END. 


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