Consultor Eletrônico



Kbase P187589: Only first output record written to OUTPUT TO destination
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   12/05/2011
Status: Unverified

SYMPTOM(s):

Only first output record written to OUTPUT TO destination

All other records are displayed on terminal.

Code similar to:
DEFINE VARIABLE ctr AS INTEGER.
OUTPUT TO report.txt.
DEFINE QUERY qCustomer FORCustomer.
OPEN QUERY qCustomer FOR EACH Customer WHERE CustNum < 100 NO-LOCK.
REPEAT ctr = 1 TO 80:
GET NEXT qCustomer.
DISPLAY CustNum Name.
OUTPUT CLOSE.

FACT(s) (Environment):

All Supported Operating Systems
Progress/OpenEdge Product Family

CAUSE:

The REPEAT block is not terminated with an END statement. Therefore the block ends at the end of the procedure, which places the OUTPUT CLOSE statement within the block. On the second iteration, the intended output destination has been closed, so the default output destination (i. e. the terminal) is used.

FIX:

Make sure the OUTPUT CLOSE statement is outside of the loop that writes each record to the intended output destination.