Great! Thanks Dianne. -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Dianne Ackerman Sent: Tuesday, June 22, 2004 12:34 PM To: [EMAIL PROTECTED] Subject: Re: [U2] Is it possible to nest 'LOOP / WHILE READNEXT / REPEAT'loops?
You'll have to name each list, for example, EXECUTE CMD CAPTURING JUNK RTNLIST LISTNAME Then you can do READNEXT ITEM.ID FROM LISTNAME Then the program can keep track -Dianne Amy Cook wrote: >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/
