how to nest for each statement when while using EXPORT state

Posted by LegacyUser on 20-Feb-2001 14:41

Helle friends,

Here is my question. I am trying to run following code snippet with mbpro utility.

DEFINE VARIABLE var-customer LIKE customer.customer.

OUTPUT TO "orderdetail.d".

FOR EACH customer

WHERE customer.acct-number >= "4000" and customer.acct-number <= "5000" NO-LOCK:

var-customer = customer.customer.

FOR EACH orderdetail

WHERE orderdetail.customer = var-customer NO-LOCK:

export crs.histdet.

END.

END. /* end for loop */

OUTPUT CLOSE.

I have tried several possibilities. The variable var-customer is redundant as direct join should work bet these two tables. All this query does is creates a file orderdetail.d with size 0, i.e. no records. Is there something wrong in the syntax of this code. Please enlighten me.

thanks.

nilesh

All Replies

Posted by LegacyUser on 23-Feb-2001 09:34

export orderdetail.

the line you've exported does not make sense.

Or at least before exporting do a find on your histdetail.

Posted by LegacyUser on 08-Mar-2001 14:01

"nilesh " wrote:

>

>Helle friends,

>Here is my question. I am trying to run following code

>snippet with mbpro utility.

>DEFINE VARIABLE var-customer LIKE customer.customer.

>

OUTPUT TO "orderdetail.d".

FOR EACH customer

WHERE customer.acct-number >= "4000" and customer.acct-number

>

var-customer = customer.customer.

>

FOR EACH orderdetail

WHERE orderdetail.customer = var-customer

>NO-LOCK:

>

export crs.histdet.

END.

END. /* end for loop */

OUTPUT CLOSE.

>

>I have tried several possibilities. The variable var-customer

>is redundant as direct join should work bet these two

>tables. All this query does is creates a file orderdetail.d

>with size 0, i.e. no records. Is there something wrong

>in the syntax of this code. Please enlighten me.

>thanks.

>

>nilesh

>

>

Try This:

OUTPUT TO orderdetail.d PAGE-SIZE 0.

FOR EACH customer

WHERE customer.acct-number GE "4000"

AND customer.acct-number LE "5000"

NO-LOCK,

EACH orderdetail

OF customer

NO-LOCK:

EXPORT orderdetail.

END.

OUTPUT CLOSE.

In your example, you are exporting a table/field which you haven't selected.

This thread is closed