Quantcast
Channel: Forums - Recent Threads
Viewing all articles
Browse latest Browse all 143529

Code Review: Chunking records into batches

$
0
0

Hi,

I'm trying to implement chunking job that would split/chunk data into Batches.

Can there be further improvement in this working code:

static void Batching(Args _args)
{
    batchtest test;
    batchtest test2;
    int ct=0,i=1,batchno=1;
    int batches = 2, rowcount;

    update_recordSet test
    setting batchno=0;

    select count(batchno) from test;
    ct = test.batchno;

    rowcount = ct / batches;

    while select forUpdate test
    {
        if(i>rowcount)
        {
            i=1;
            batchno++;
        } 
        ttsBegin;
        test.batchno=batchno;
        test.update();
        ttsCommit;
        i++;
    } 
}



Viewing all articles
Browse latest Browse all 143529

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>