In that case, use the remove command
here's an example

SUBROUTINE PROGRAMA.PRG
*------------------------------------------------------------------------------
$INCLUDE DMSKELCODE COMMON
$INCLUDE DMSKELCODE SBPLUS.EQU
*--- CONFIDENCIAL -------------------------------------------------------------
* Escrito por .- Marco Rojas
* Fecha Creada .- 06/22/2004 6:12 pm
* Descripcion .-
*------------------------------------------------------------------------------
CALL SB.OPEN.FILE('SO', F.SO, RTN.FLAG) ; IF RTN.FLAG THEN RETURN
CALL SB.OPEN.FILE('PMT', F.PMT, RTN.FLAG) ; IF RTN.FLAG THEN RETURN


EXECUTE 'SELECT SO WITH INV.IDS = "10000020"' CAPTURING OUT
READSELECT A.SO.ID ELSE A.SO.ID = ''
LOOP
  REMOVE SO.ID FROM A.SO.ID SETTING DM1
  READ R.SO FROM F.SO, SO.ID THEN
     EXECUTE 'SELECT PMT WITH SO.ID = "':SO.ID:'"' CAPTURING OUT
     READSELECT A.PMT.ID ELSE A.PMT.ID = ''
     LOOP
        REMOVE PMT.ID FROM A.PMT.ID SETTING DM2
        READV PMT.AMT FROM F.PMT, PMT.ID, 5 ELSE PMT.AMT = 0
        TOT.PMT.AMT += PMT.AMT
     UNTIL DM2 = 0 DO REPEAT
  END
UNTIL DM1 = 0 DO REPEAT
RETURN



From: Robert Stearns <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: Re: [U2] Is it possible to nest 'LOOP / WHILE READNEXT / REPEAT' loops?
Date: Tue, 22 Jun 2004 15:56:56 -0400


Use the FROM option.

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/

_________________________________________________________________
Charla con tus amigos en lmnea mediante MSN Messenger: http://messenger.latam.msn.com/
-------
u2-users mailing list
[EMAIL PROTECTED]
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to