× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



I have a  requirment where iam using Loadall subfile...The no of
records Iam having right now is around 9000(less than9999)...Now I
have to add another 4thousands of records to this...I dont like to
reprogram it by using single page subfile...How can i do this with
Loadall subfile?Am I going to loose any records if i add 4
thousand records to the already existing 9000 records....I cant
reprogram it....I ve to do with Load all only....Can u please help
giving answer to this....
Best Regards
Murali.

On Thu, 10 Oct 2002 Scott Klement wrote :
On Wed, 9 Oct 2002, Steve Richter wrote:
>
> Its just a hunch of mine.  C relies on null term strings so I
am speculating
> that ILE handles them efficiently.
>

Okay, I wrote & ran some benchmarks on these things.  To my
surprise, both
fixed-length and null-terminated strings performed SIGNIFICANTLY
better
than varying.  About twice as fast!   I hope Hans or Barbara can
explain
why...

This was done on my company's iSeries, 9406-270(2248) at V4R5.
I was the only person online / only job running.
I did not enable any special optimization for either compiler.
All the strings I passed were 32000 bytes long.

Here's the results:

Description                             Iters per Second
--------------------------------        -----------------
ILE RPG fixed-len by value                  4167
ILE RPG fixed-len by reference            416667
ILE RPG null-terminated by value            4167
ILE RPG null-terminated by reference      416667
ILE RPG varying by value                    2083
ILE RPG varying by reference              217391
ILE C null-terminated by value              8333
ILE C null-terminated by reference       1666666


Here are the programs that I used to perform the test.   Note
that I
assigned a 'x' to the first byte in each string in each function
just
to make sure the compiler didn't "remove" the routine during some
sort
of optimization.

     H DFTACTGRP(*NO) ACTGRP(*NEW)

     D by_value        PR
     D   data                     32000A   value
     D by_reference    PR
     D   data                     32000A
     D v_by_value      PR
     D   data                     32000A   value varying
     D v_by_reference  PR
     D   data                     32000A   varying
     D n_by_value      PR
     D   data                     32000A   value
     D n_by_reference  PR
     D   data                     32000A

     D data            S          32000A
     D data2           S          32000A   varying
     D start           S               Z
     D end             S               Z
     D diff            S             10I 0
     D msg             S             50A
     D x               S             10I 0

     c                   eval      data = 'This is not a
null-terminated '+
     c                                     'string.'
     c                   eval      data2= 'This is not a
null-terminated '+
     c                                     'string.'

     c                   time                    start

     c                   for       x = 1 to 50000
     c                   callp     by_value(data)
     c                   endfor

     c                   time                    end

     c     end           subdur    start         diff:*seconds
     c                   eval      msg = 'by-value ' +
%editc(diff:'Z')
     c     msg           dsply

     c                   time                    start

     c                   for       x = 1 to 5000000
     c                   callp     by_reference(data)
     c                   endfor

     c                   time                    end

     c     end           subdur    start         diff:*seconds
     c                   eval      msg = 'by-ref ' +
%editc(diff:'Z')
     c     msg           dsply

     c                   time                    start

     c                   for       x = 1 to 50000
     c                   callp     v_by_value(data2)
     c                   endfor

     c                   time                    end

     c     end           subdur    start         diff:*seconds
     c                   eval      msg = 'v-by-value ' +
%editc(diff:'Z')
     c     msg           dsply

     c                   time                    start

     c                   for       x = 1 to 5000000
     c                   callp     v_by_reference(data2)
     c                   endfor


     c                   time                    end

     c     end           subdur    start         diff:*seconds
     c                   eval      msg = 'v-by-ref ' +
%editc(diff:'Z')
     c                   dsply                   msg

     c                   eval      data = 'This is now a
null-terminated '+
     c                                     'string.' + X'00'

     c                   time                    start

     c                   for       x = 1 to 50000
     c                   callp     n_by_value(data)
     c                   endfor

     c                   time                    end

     c     end           subdur    start         diff:*seconds
     c                   eval      msg = 'n-by-value ' +
%editc(diff:'Z')
     c     msg           dsply

     c                   time                    start

     c                   for       x = 1 to 5000000
     c                   callp     n_by_reference(data)
     c                   endfor

     c                   time                    end

     c     end           subdur    start         diff:*seconds
     c                   eval      msg = 'n-by-ref ' +
%editc(diff:'Z')
     c                   dsply                   msg

     c                   eval      *inlr = *on

     P by_value        B
     D by_value        PI
     D   data                     32000A   value
     c                   eval      %subst(data:1:1) = 'x'
     P                 E


     P by_reference    B
     D by_reference    PI
     D   data                     32000A
     c                   eval      %subst(data:1:1) = 'x'
     P                 E


     P v_by_value      B
     D v_by_value      PI
     D   data                     32000A   value varying
     c                   eval      %subst(data:1:1) = 'x'
     P                 E


     P v_by_reference  B
     D v_by_reference  PI
     D   data                     32000A   varying
     c                   eval      %subst(data:1:1) = 'x'
     P                 E


     P n_by_value      B
     D n_by_value      PI
     D   data                     32000A   value
     c                   eval      %subst(data:1:1) = 'x'
     P                 E


     P n_by_reference  B
     D n_by_reference  PI
     D   data                     32000A
     c                   eval      %subst(data:1:1) = 'x'
     P                 E



#include <stdio.h>
#include <string.h>
#include <time.h>

struct my_data {
    char string[32000];
};

void by_value(struct my_data d);
void by_reference(char *str);

int main(void) {
    struct my_data dta;
    time_t start, end;
    int x;

    strcpy(dta.string, "This is now a null-terminated
string.");

    time(&start);

    for (x=0; x<50000; x++)
           by_value(dta);

    time(&end);

    printf("By-value total time %f seconds\n",
difftime(end,start));

    time(&start);

    for (x=0; x<5000000; x++)
           by_reference(dta.string);

    time(&end);

    printf("By-reference total time %f seconds\n",
               difftime(end,start));


    return 0;
}

void by_value(struct my_data d) {
    d.string[0] = 'x';
}

void by_reference(char *str) {
    str[0] = 'x';
}

_______________________________________________
This is the RPG programming on the AS400 / iSeries (RPG400-L)
mailing list
To post a message email: RPG400-L@midrange.com
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/cgi-bin/listinfo/rpg400-l
or email: RPG400-L-request@midrange.com
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.

__________________________________________________________
Give your Company an email address like
ravi @ ravi-exports.com.  Sign up for Rediffmail Pro today!
Know more. http://www.rediffmailpro.com/signup/



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.