I had to create a 'break.my.list' to limit the amount of HUGE files that were being downloaded to an excel spreadsheet so that we could finish selling our company to Moen Faucet so they could close us down. Fun eh?
Anyway, this is what I used to break up the huge lists so I could process files in chunks. Most of the COMMON stuff pertains only to Manage-2000 installs, and are routinely included in all m2k programs, and is probably not even needed. I'm sure you'll need to cannibalize it to make it a part of your current program, but at least you can see what I did to make it work. Other than that, why can't you just put a byte counter on your output and stop when it reaches a certain limit, and then do your write, and then continue again? * Release Information * MANAGE-2000 - CSI Donner - Release 6.2e * BREAK.MY.LIST - Written 08-06-99 *===/============================================================\===* * / Written by Allen E. Elwood 08/06/99 - AK Savage Software \ * =We= *<------------------------------------------------------------------>* =Be= * \ (c) Copyright 1999 by AK Savage Software - All Rights Reserved / * =Bad!= *===\============================================================/===* *** * Permission hereby granted per Allen Elwood to allow this code to be modified * and shared under an open-source license. Please feel free to enhance and improve * as you see fit, but retain all header information you see here. * *** Gnu General Public License * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. www.gnu.org * *** * Revision Log * Who..... When..... Why................................................................ * AElwood 1999Aug06 Initial coding. * Andrew 1999Aug06 Added command line argument feature. Changes marked * with *[001]. Added open source license info with * original author's permission. Thanks Allen! * *** * *#* COPY COPY.TOOLS.BP STANDARD.VARIABLES.2 (REPLACING PGM.NAME BY BREAK.MY.LIST, FN.NAME BY BREAK.MY.LIST, IO.OPEN.OPTS BY TERM.DATA:LOCK:XREF) ;*#* Copied Source Follows (08-06-99) $INCLUDE STANDARD.COMMON.VARIABLES FROM COPY.TOOLS.BP $INCLUDE STANDARD.COMMON.APP.PROGRAMS FROM COPY.TOOLS.BP $INCLUDE COM500 FROM COPY.TOOLS.BP $INCLUDE STANDARD.VARIABLES.END FROM COPY.TOOLS.BP PGM.NAME='BREAK.MY.LIST'; FN.NAME ='BREAK.MY.LIST' CALL IO.OPEN('TERM.DATA:LOCK:XREF',PASSWORDS) *#* *=========================================================================== ==== * Note that this program remains the intellectual property of Allen E. Elwood * and may not be re-sold under any conditions. You can give it away, but if * you charge for it, you'll find me knocking on your front door, probably, * really late at night. Also note that this program is not guaranteed to * do ANYTHING AT ALL. No functionality is implied or expressed. * Also note that it looks awful, I was in a hurry.... *=========================================================================== ==== *#* OPEN SAVEDLISTS ;*#* Open Source Follows IF PASSWORDS # '' THEN CALL SUB.PASSWORDS(PASSWORDS) OPEN.ERROR = '' OPEN '', 'SAVEDLISTS' TO SAVEDLISTS ELSE OPEN.ERROR<-1> = 'SAVEDLISTS' IF OPEN.ERROR # '' THEN CALL SCREEN.MSG('OPEN ERRORS':AM:OPEN.ERROR) GO 999 END COM_FILES.LIST<1,-1> = 'SAVEDLISTS' *#* *=========================================================================== ==== * get info PARMS = CONVERT (" ",@FM, UPCASE(TRIM(@SENTENCE))) ;*[001] DEL PARMS<1> ;*[001] IF PARMS THEN ;*[001] IN.LIST = PARMS<1> ;*[001] RT.LIST = PARMS<2> ;*[001] SAMPLE.MOD = PARMS<3> ;*[001] MONGO = "Y" ;*[001] IF NOT (SAMPLE.MOD) THEN ;*[001] CRT "Usage: BREAK.MY.LIST InputListName RootListName SampleSize";*[001] STOP ;*[001] END ;*[001] END ELSE ;*[001] * PRINT CLR:B4.T PRINT ' This utility will break a list up into smaller lists. ' PRINT ' You will be asked for the source list name, the root name ' PRINT ' and for the desired size of the new, smaller, lists to make. ' PRINT ' Theses new "sub-lists" will be the root name with a number appended.' PRINT ' Example: A root name of DAISY would create sub-lists ' PRINT ' Named DAISY1 DAISY2 DAISY3... Until the list source list is expired.' PRINT AFT.T PRINT ' Enter the list name to break up : ':;INPUT IN.LIST PRINT ' Enter the root name for sub-lists : ':;INPUT RT.LIST PRINT ' Enter sample size for the sub-lists : ':;INPUT SAMPLE.MOD PRINT ' Continue? (Y/END) : ':;INPUT MONGO PRINT *=========================================================================== ==== *Verify IF UPCASE(MONGO) = 'END' THEN STOP IF UPCASE(MONGO) # 'Y' THEN PRINT 'Invalid entry' STOP END PERFORM 'GET.LIST ':IN.LIST [EMAIL PROTECTED] IF SELECTED < 1 THEN PRINT 'There were no entries in list ':IN.LIST STOP END *=========================================================================== ==== *On yer marks IN.COUNT = 0 OUT.REC = '' OUT.COUNT = 1 *=========================================================================== ==== *GOOOOoooooo...... LOOP READNEXT ID ELSE EXIT OUT.REC<-1> = ID IN.COUNT += 1 IF IN.COUNT = SAMPLE.MOD THEN GOSUB WRITE.SUB.LIST END REPEAT IF IN.COUNT>0 THEN *Any leftovers? GOSUB WRITE.SUB.LIST END *=========================================================================== ==== * Finish off PRINT 'There were ':OUT.COUNT-1:' sub-lists created from ':IN.LIST PRINT 'End of job' PRINT *=========================================================================== ==== * /\/\/\/\ * STOP * \/\/\/\/ * *=========================================================================== ==== WRITE.SUB.LIST: OUT.ID = RT.LIST:OUT.COUNT PERFORM 'DELETE.LIST ':OUT.ID CAPTURING JUNK OUT.ID := '000' WRITE OUT.REC TO SAVEDLISTS, OUT.ID OUT.COUNT += 1 OUT.REC = '' IN.COUNT = 0 RETURN *=========================================================================== ==== 999* PROGRAMMED.ABORT: SS= 'Program:':PGM.NAME:', Function:':FN.NAME:' - Aborted - ' SS:='Call Systems;B;E;A;C;H' CALL SCREEN.MSG(SS) STOP END *=========================================================================== ==== -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of [EMAIL PROTECTED] Sent: Monday, December 13, 2004 17:48 To: [EMAIL PROTECTED] Subject: [U2] How to batch SELECT ... TOXML I am sending XML from UniVerse to a webserver using callHttp. Currently we're on UV10.0.7 and won't be upgrading to a version of UV with XMLExecute() any time soon. The current technique is to "EXECUTE 'LIST CUSTOMERS ... TOXML' CAPTURING postData". This works fine for relatively small amounts of data but it doesn't take long for the amount of XML to blow the workspace when postData gets a few thousand rows into it. I was just wondering if there was some technique someone has worked out to get the 'next set' of records using an active select list. eg. SELECT CUSTOMERS LOOP WHILE ACTIVE.LIST DO EXECUTE 'LIST ... NEXT 5000 TOXML' CAPTURING postData REPEAT My next option is to issue a select and then manually build select lists for each set of rows. This would be somewhat cumbersome and add overhead to something that needs to be efficient. Or maybe there's some cute SQL syntax??? Any suggestions? -- Regards, Stuart Boydell ********************************************************************** This email message and any files transmitted with it are confidential and intended solely for the use of addressed recipient(s). If you have received this email in error please notify the Spotless IS Support Centre (61 3 9269 7555) immediately who will advise further action. This footnote also confirms that this email message has been scanned for the presence of computer viruses. ********************************************************************** ------- 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/
