Actually, it's just "losing track" of which list you're processing.
Can you do a SELECT with the TO option in Unidata?
Do the first SELECt to LIST1, then the next to List to, then do the READNEXT FROM LIST1 and READNEXT FROM LIST2...
"Our greatest duty in this life is to help others. And please, if you can't help them, could you at least not hurt them?" - H.H. the Dalai Lama
"When buying & selling are controlled by legislation, the first thing to be bought & sold are the legislators" - P.J. O'Rourke
Dan Fitzgerald
From: "Amy Cook" <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
To: <[EMAIL PROTECTED]>
Subject: [U2] Is it possible to nest 'LOOP / WHILE READNEXT / REPEAT' loops?
Date: Tue, 22 Jun 2004 12:15:44 -0700
UniData, BASICTYPE P
While debugging something I'm working on, I figured out I couldn't use the LOOP / WHILE READNEXT / REPEAT as I had originally planned...seems if you nest one inside the other, it loses track of which 'next' you're asking for (I'm sure this is by design, I just either haven't run across it yet, or am not using an option that is available to me...)
For instance, in the code below, if my first active select list at line 003 contained 2 record ID's (1 & 2), and my second active select list at line 011 also contained 2 record ID's, (A & B), then by the time I read in my first SOD.ID at line 013, it was reading the 2nd record of my first active select list (i.e. '2' instead of 'A')
001: CMD = 'SELECT SOHDR WITH DATE GE "':BEG.DT:'" AND WITH DATE LE "':END.DT:'"'
002: CMD = CMD:' AND WITH STATUS NE "C" AND WITH PROD_LINE = "':ITP:'"'
003: EXECUTE CMD CAPTURING JUNK ;*need error trap
004: LOOP
005: WHILE READNEXT ITEM.ID DO
006: READ SOH.REC FROM SOH,ITEM.ID ELSE SOH.REC=''
007: BILL2 = SOH.REC<2> ;*bill-to cust
008: SLSPROG.ID = SOH.REC<15>
009: READV SLSPROG FROM SYST,"OSC*":SLSPROG.ID,4 ELSE SLSPROG='' ;*SlsProg Desc
010: CMD1 = 'SELECT SODET = "':ITEM.ID:']"'
011: EXECUTE CMD1 CAPTURING SOD.JUNK
012: LOOP
013: WHILE READNEXT SOD.ID DO
014: READ SOD.REC FROM SOD,SOD.ID ELSE SOD.REC='' ;*line record
Anyway...does anyone have either
(a) a way to nest READNEXT's, or
(b) another suggestion? ...I was thinking maybe a count on the records of the 2nd file that meet my criteria, then a FOR/NEXT...? ------- u2-users mailing list [EMAIL PROTECTED] To unsubscribe please visit http://listserver.u2ug.org/
------- u2-users mailing list [EMAIL PROTECTED] To unsubscribe please visit http://listserver.u2ug.org/
