I'm going to try this as well next wed. Thanks. ----- Original Message ----- From: "Rex Gozar" <[EMAIL PROTECTED]> To: <[email protected]> Sent: Friday, August 12, 2005 8:31 AM Subject: RE: [U2] Remove Scenario
> Tony had a point in that redesign would probably give better performance, > but here are some thoughts that may be helpful in the short term. > > 1) Using a multi-dimensioned array would be a little faster: > > IF BAL # 0 THEN > MV=MV+1 > BIG(MV,1)=ID > BIG(MV,2)=SOMETHING ELSE > etc. > > 2) In regard to an opposite of REMOVE, there really isn't a function but > rather a technique. Create a large buffer and use substring assignment, > e.g. > > BUFFER = SPACE(999999) > BUFPTR = 0 > LOOP > VAR = SOMETHING > L = LEN(VAR) > BUFFER[1+BUFPTR, L] = VAR ; * substring assignment > BUFPTR += L > LATHER RINSE REPEAT > > I've used code like this when building large strings and it's very fast. If > you get near the end of the buffer, you can always double its size. > > > -----Original Message----- > > From: [EMAIL PROTECTED] > > [mailto:[EMAIL PROTECTED] Behalf Of Mark Johnson > > Sent: Friday, August 12, 2005 12:26 AM > > To: [email protected] > > Subject: [U2] Remove Scenario > > > > > > Here's a doozy. > > > > Thanks for the previous suggestion of using REMOVE instead of the <> > > extractions. That's working very well. > > > > New problem. > > > > One client's application is written in The Programmer's > > Helper (TPH) which > > MATREADS and has EQUATES assigning variables like INVNO.TABLE > > TO CUST(40) > > etc. > > > > The program is written with INVNO.TABLE<1,X> style extracts > > everywhere. There > > are probably 15 mv'd fields with the suffix TABLE and their > > mv counters are in > > sync. > > > > Prior to using REMOVE (it had an issue on D3), I MATREAD in a > > BIG(300000) > > array which breezed through the high item count of 155,000 > > records.(REMOVE > > took 8 seconds, BIG took around 12 and <> took over 9 minutes). > > > > Here's the rub. This is a Cash Reciept application where the > > BIG array is one > > customer's invoices. The load-in process jogs through the BIG > > array and for > > those items with a non-zero balance, it creates these 15 > > TABLE variables. > > Trouble is, if there's 155,000 total records for this 1 > > customer, 100,000 may > > have a balance of zero leaving 50,000 to be handled in the > > application. > > > > So while REMOVE is a great way to extract from BIG as a > > dynamic array and > > MATREAD is great for extracting from a DIM array, what would > > be the best way > > to build these 15 separately named TABLE variables. The > > original program (sans > > REMOVE) looked like this: > > > > C=DCOUNT(BIG,CHAR(254)) > > FOR I=1 TO C > > ID=BIG<I> > > READV BAL FROM ARFILE, ID, 10 THEN > > IF BAL # 0 THEN > > INV.TABLE<1,-1>=ID > > AAA.TABLE<1,-1>=SOMETHING ELSE > > BBB.TABLE<1,-1>=SOMETHING ELSE > > CCC.TABLE<1,-1>=SOMETHING ELSE > > MMM.TABLE<1,-1>=SOMETHING ELSE > > END > > END > > NEXT I > > > > So while REMOVE is a great extractor for these 150,000 > > fields, what is a great > > inserter for these 15 TABLE variables. In essence, the BAL # > > 0 is 50,000 > > records. > > > > I tried > > MV=MV+1 > > INV.TABLE<1,MV>=ID > > etc > > > > and got a minor improvement. > > > > I tried > > INV.TABLE:[EMAIL PROTECTED]:SOMETHING ELSE > > etc > > > > and got a slightly better improvement. > > > > In either case, you could see the progressive (exponential) > > delay as it > > performs these 50,000 (x 15) TABLE actions. > > > > I tried using my DIM BIG(300000) where the dim element number was the > > insertable MV and I used the dynamic array concept on each > > dimensioned array > > element. Thus: > > > > MV=0 ; L=0 > > LOOP > > REMOVE ID FROM XREF AT L SETTING D > > READV BAL FROM ARFILE, ID, 10 THEN > > IF BAL # 0 THEN > > MV=MV+1 > > BIG(MV)<1>=ID > > BIG(MV)<2>=SOMETHING ELSE > > BIG(MV)<3>=SOMETHING ELSE > > BIG(MV)<15>=SOMETHING ELSE > > END > > END > > UNTIL D=0 DO ; REPEAT > > > > and it took only 8 seconds. Cool. So now I have a dimensioned > > BIG array with > > 50,000 elements each having 15 attributes. > > > > Because the infidel TABLE variables are scattered throughout > > this generated > > 1,500 line program, I don't want to search and replace them > > all with their > > BIG(MV)<12> equivilents unless I really have to. Eventually, > > I have to take > > these mv'd TABLE variables and writev (sic) them onto the data file. > > > > MATBUILD doesn't seem to work with 2 dimensioned dimensioned > > arrays nor with > > elements containing attributes or values. It only likes the > > elements being > > simple variables. > > > > If this were a report program I would kick it off on a > > phantom and be done > > with it. Since it's a user oriented Cash Receipts program, > > the user literally > > waits 5-9 minutes while a single customer 'loads'. Of course, > > the larger more > > important customers are handled more frequently, thus more headaches. > > > > So the question is whether there is an INSERT or append > > function with the > > magic of REMOVE. > > > > Thanks for any insights. > > Mark Johnson > > ------- > > 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/ ------- u2-users mailing list [email protected] To unsubscribe please visit http://listserver.u2ug.org/
