How to run CFLOOP in a batch of 100

I need to loop over a logic for each record I queried from a table once a day
Each day our dept. may receive a different number of records. Today we may get 100 new records, tomorrow may be 5000 and the next day again may be none.
My application crashes whenever we get 5000 or more records; so, I plan to loop in a batch of 100, for example, if today I get 5000 records, I want to run my app. 50 times, each process is looping 100 records. Is there a way to do this?

The solution depends on just what is really causing your CF script to fail - can you give us information on the error you are receiving from CF?  Are you running out of memory?  If so, is it because the resultset from the query is so large, or is it because there is code in the CFLOOP that is causing memory usage to grow (creating variables, adding to a structure, displaying data to the output stream, etc)?  Are you sure that CF is crashing, and not your browser?
If the problem is the overall memory footprint due to the size of the query, then one possible way to solve this is to create a var at the top of the script (variables.recordsToProcess), give it a value of around 100 to start with, and then write  a query just to get the total record count (SELECT COUNT(*)).  Now you can compute the number of passes needed to process all of the data, and can wrap most of your current code in a CFLOOP  where the SQL query you are using now has been modified to return only one chuck of data (TOP #variables.recordsToProcess#), and the current CFLOOP only processes that chunk of data(TO="#variables.recordsToProcess#).
If the problem is due to an expanding memory footprint that you cannot get around,  another conceptually similar way to solve this is If you pass a URL var to the script (url.recordsToProcess) that you can then use in the SQL query (TOP #url.recordsToProcess#), and in the CFLOOP (TO="#url.recordsToProcess#).  Then write another script that does a query just to get the total record count, and have it loop over a CFHTTP call (that passes the URL var as a query param) to your current script for the appropriate number of times.  If the reason for the memory expansion is because you are writing a lot data to the output stream, then as you execute each CFHTTP you can append its output to a file.  that way you don't have all of the data sitting in CF memory at any one time.  If you need to make the output stream accessible to the browser, then at the end of that script that is doing the cfhttp calls, just put a link to the file that the user can click on - or you could put in  a CFCONTENT tag that points to the file.
You're not using CFDUMP in there to output data, are you?  If so, then get rid of it and your problems will probably go away.  Just spit out an HTML table with your data - you won't have all of the JS crappola that CFDUMP puts in there.
-reed

Similar Messages

  • Please help how to run System commands and batch files thru java program

    Sir,
    I want execute OS commands like dir,cls..etc and batch files,.exe filesthru java program.
    I have tried it sofar thru Runtime.getRuntime().exec("execute.bat");
    but it is not working.anybody knows about how to run the system commands thru java please give me the code.
    thank you,
    regards,
    j.mouli

    I've seen other posts with this questions, and answers. Unfortunately I didn't pay much attention. But the basic idea is to exec command.com and pass the specifc batch or command as an argument.

  • How to run Acrobat OCR in batch mode?

    I have many pdf files that I need to run OCR on. It is tedious to open each file and run OCR manually. I'm wondering if there is a way to automatically run OCR on all the files.

    Use the Batch Sequence (Acrobat 8 or 9) or an Action (Acrobat X) available with Acrobat Pro.
    Be well...

  • How to run sql scripts using batch file for a web dynpro data dictionary

    Hi,
    I want to develop a sql script to be executed on the server alongwith the installation of a product to pre-populate web dynpro data dictionary tables required for the application.
    I further require to make the scripts independent of the database name,so that it can be run at any client environment.
    Your help will be appreciated and rewarded.

    See shoblock's answer
    call sql script from unix
    masterfile.sql:
    @file1 &1
    @file2 &2
    @file3 &3
    @file4 &4
    then just call the master script:
    sqlplus userid/password @masterfile <p1> <p2> <p3> <p4>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • How to run the Invoices in different groups within the batch in AP

    Need to know that how to run the Invoices in different groups within the batch. This will be of very helpful when we deal with lot of lines under one batch. (e.g) like somewhere we issued a Corporate Card to all the employees Via Bank Of America. Every Month they will send the complete details of all the employees who ever swiped the corporate provided BOA. Accordding to Natco all those lines should be loaded as One Invoice so that a Single Payment can be provided to BOA and it will also makes their life easier. This standard program sometimes it works normal sometimes it will run like a TORTOISE. So thats why in the manual they suggested to use GROUP ID to split the Invoice Load.
    So plz tell me how we can run it
    plz give me the solution
    thanks

    can you give me some material or document on that so that i can read actuaaly i need to make doc on it..

  • How to run a 10g report in batch mode.

    Good Afternoon,
    Please advise if there is a way to run a 10g report from command line.
    We use 6i right now and our job scheduler runs reports using "D:\ORADEV6I\BIN\RWRUN60.EXE ..." executable in batch mode on a separate server. We plan to migrate to 10g Database, Forms, Reports. Is there a way to keep this functionality and create a "command" to request the report server to run a report?
    Thank you,
    Dmitri

    For those of you interested in following this refer to the same thread in the Reports Forum:
    How to run a 10g report in quiet\batch mode

  • How to run a project which gets parameters from a batch file

    Hello all,
    I use to run a program, which gets parameters only by interactive mode, using a batch file as you can see below:
    # myprogram < batchfile.txt
    Now, I'm updating its code by SunStudioExpress IDE and I'd like to run it from the batchfile. I have noticed that the project properties window has the option run -> arguments, however this program doesn't accept arguments this way and for changing it, I'd have a hard job.
    Does someone know how to run this project and to get its parameters from batchfile?
    Regards,
    Glauber

    Ah, it appears that when you run the project, "<" is passed as one of the arguments and is not treated as input redirection.
    Sorry, it looks like it is not possible to do the redirection; and it looks like a bug to me. Could you please file it through bugs.sun.com? It shouldn't take long as the problem is evident now.

  • How to run a batch file using tigger....

    Hi, i am trying run a batch file using a trigger on a table.
    say i have a table XYZ(col_1 varchar2 primary key, col_2 varchar2)
    the values of col_2 keeps changing and col_1 are constant
    whenever the value of col_2 in any row changes from "on" to "off" i want to run a batch file C:\Users\ABC\Desktop\test.bat
    i did some searching but couldn't find any solution. Thanks in advance
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    sorry wrong foum to post.
    will post in the correct one
    how to run batch file using trigger?

    Hallo,
    welcome to the forum.
    This is the forum for the tool {forum:id=260}. Your question should be placed in {forum:id=75} or {forum:id=61}.
    When you post your question there please provide additional information like db version, what kind of trigger you want to use, how you want to prevent the execution when the transaction is rolled back... {message:id=9360002}
    Regards
    Marcus

  • How to run a batch file as windows Nt service

    Hi friends
    I want to know how to run a batch file as windows NT service.
    I got some information in the following link
    http://support.microsoft.com/kb/q243486/
    I tried it but i want to know what we need to include in Autoexnt.bat
    And one thing i need Instexnt.exe file. I cannot find tht file.
    Please search tht file and send me tht file or else send the link in which this file is present
    Please give me reply fast.its very urgent.
    Thanks in advance.

    Hi,
    My aim is to run a MS-DOS Batch file, that I created to run a Java Prgram.
    I need to call the Batch File from the Oracle Procedure, Also I may need to change the content of the Batch File (Argument to the Java JAR File ).
    I can keep the JAR FIle either in the Oracle Server or in the Application Server.
    The Java program is to convert XML Format FIle to PDF and MS Word format.
    Oracle Version : 10g 2.0.1.0.
    Thanks in advance
    Rizly

  • How to run a batch file

    Hi,
    How to run a batch file from Oracle. Is it possible directly from PLSQl, or should I write the java code.
    Oracle Version: 10g 2.0.1.0.
    Thanks in advance
    Rizly

    Hi,
    My aim is to run a MS-DOS Batch file, that I created to run a Java Prgram.
    I need to call the Batch File from the Oracle Procedure, Also I may need to change the content of the Batch File (Argument to the Java JAR File ).
    I can keep the JAR FIle either in the Oracle Server or in the Application Server.
    The Java program is to convert XML Format FIle to PDF and MS Word format.
    Oracle Version : 10g 2.0.1.0.
    Thanks in advance
    Rizly

  • How to run the batch files

    Hi Experts,
    I am trying to implement automatic cache purging every day at specified time and i created txt file with SApurge All cache() and created bat file with nqcmd -q Analyticsweb -u username -p password -s (txt file location).
    Now i want to run this bat file daily at specified time with out executing manually may i know how to run the batch file at specified time .
    Thanks,

    There is task type as command in workflow manager if you want you can go for that during the load
    nqcmd -d "AnalyticsWeb" -u Administrator -p Administrator -s "D:\PowerCenter8.1.1\server\infa_shared\SrcFiles\1_BIPurgeCache.txt"
    Check these urls
    http://docs.oracle.com/cd/E12103_01/books/AnySched/AnySched_Scripts3.html
    http://deliverbi.blogspot.com/2011/12/purge-all-cache-from-dashboard.html

  • How to run a ABAP Program in Batch JOB

    How to run a ABAP Program in Batch JOB ?

    Hello Manish,
    Using transaction SM36 you can define the batch job along with the start conditions for that job.
    1. Transaction SM36.
    2. Give the Z name of the job in the 'Job Name' input field.
    3. Click on 'Steps' button from the application toolbar.
    4. On the 'Create Step 1' dialog box, give the name of the ABAP program in the 'ABAP Program' section' along with the variant.
    5. Click on 'Check Input' button from the dialog box.
    6. Click on 'Save' button from the dialog box once the check is successful.
    7. One list will be shown. Click on Back button from the standard toolbar.
    8. Click on 'Start Conditions' button from the application toolbar. Specify the start condition e.g. immediate. Click on save.
    9. The job staus is now scheduled.
    10.Click on Save button from the standard toolbar of SM36. The job status will be released.
    Using SM37 you can monitor the status of the job.
    This will sort out your problem.
    PS If the answer solves your query, plz reward points.
    Regards

  • How to run the Batch input session(SM35) in background thru Report program

    Hi Experts,
    I am working in one modification report requirement ,the report is Mass upload will update and run the file via batch input session. The client requirement is to implement the report execution in background mode , the batch input session will process automatically (ie. the job runs the batch input session in background and process the session ends).
    Currently, the report calls SM35 to write a batch input session and the user manually selects the session and record the transactions.
    Once the Transaction enters and the selection-screen inputs are given, then the transaction executed in background mode and all the above batch input process to be implemented.
    Please advise and guide me, how to proceed.
    I need your guidance to proceed via Call transaction using bdcdata statement, if it can be achieved the requirement.
    Thanks & Regards
    San.

    Hi Arabind Prasad,
    Thanks for your inputs.
    I know the process of the report Execution in background and job steps.
    I want the inputs for how to upload thru Batch input session in background job and the session should also processed automatically
    Currently the report logic declared like call transaction 'SM35' and skip first screen.Once the report (tcode) executed (not in background) It writes one session in SM35. The user should select the session and process the transaction manually.
    The new requirement is, if the report (tcode) executes in background mode...what and how the batch input session should be declared and how it process automatically (like you said mode 'N').
    Hope I am clear in my query.
    Please advise.
    Regards
    San.
    Edited by: San Learner on Mar 1, 2011 7:16 PM

  • How to run group solve with the batch manager

    I'd like to know if it is possible (and how) to run group solve defined in OFA with the batch manager.
    Thank you
    Luigi Polverini
    Synesis s.r.l.

    OFA uses its Task Processor rather than Batch Manager to run tasks in batch. Group solves can be scheduled this way by submitting the group solve task to the TP, and then rescheduling it in the Task Queue window.
    null

  • How to run the emca batch file

    Hello,
    I would just like to know how to run the emca batch file for a single test database on my PC with SID = ORCL1.
    Hope someone can help me.
    Thanks!

    Hi
    If you mean running EMCA as batch file and test something.
    I think the best way is to write OS level script to handle this

Maybe you are looking for

  • Using multiple Iphones on one computer

    My family has multiple Iphones and I was wondering if there is a way to have three seperate accounts on one computer? I don't want my apps or music to be synced on my son's or wife's phone. How do I do this? Help!

  • How to register a custom MBean in weblogic 9.1

    Dear All, In weblogic 8.1, I usually register my custom mbeans using the <startup> tag in config.xml file. But in weblogic 9.1 I can not do this. <startup> tag is unrecognizable in weblogic config.xml file. Anybody knows how to write a java program a

  • UNABLE TO CONNECT TO ITUNES ON WINDOWS PC

    I tried most of the advise here but it did not work. I kept gtting a blank screen and could not sign in. In the end, I found that the problem in my case was the software SPEEDbit Video Accelerator. I uninstalled it and walla!! Connection was immediat

  • JDBC Driver Class for DB2 databases on OS/390

    Hi, To anybody who can help. I am trying to connect to DB2 database on OS/390 from my PC - Windows 2000. I have loaded IBM DB2 Application Development Client V7.2 as well as IBM DB2 Administration Client V7.2 I guess this is called using Db2 Connect.

  • System Status WCRE is active unalbe to release production order

    Unable to release production order, System status is WCRE is active.