Re: C program for QDFRTVFD API

Frank Kolmann <[email protected]>
Newsgroups gmane.comp.lang.as400.c
Message-ID <CAB-SQvho-uNco=UMsF2xd7FjhQ++maW+PYv0Jbx=iKH7Eqy5Lg@mail.gmail.com>
Hi Jevgeni

Thank you for your reply , much appreciated.
However I am not sure what you mean.
I am happy to be corrected if I am wrong.

From my code you can see.
I only Create and Populate the Userspace  for the #FIRST record.

       /* On First pass get the API data */
       memmove(Funct,p_iFunc, strlen(p_iFunc));
         if (!memcmp(Funct, "#FIRST", 6)) {
            RtvApiDta();
            };

On the #NEXT calls I just get the pointer to the Userspace.

         if (!memcmp(Funct, "#NEXT", 5)) {
    /*! call RetrievePointerToUserSpace - Retrieve Pointer to User Space */
           errorCode.BytesProvided = 0;
           RetrievePointerToUserSpace("RTVFDUSPC QTEMP      ",
                            &pBuffer,
                            &errorCode);
       }

Also I  Delete the User space when there are no more fields to get.

    Odata->EndDta   = 0;
   /* End ofthe Fields  */
      if ((EndFlds EQ 1) && (FldIdx EQ p_QDFFRINF->WDFFFLD -1) ) {
        Odata->EndDta   = 1;
         *GotIt = 1;
        DeleteUserSpace("RTVFDUSPC QTEMP      ",
                        &errorCode);
       };


So I believe I am doing the code correctly exactly how you describe it
should be done.

Regards
Frank


> •Subject: Re: C program for QDFRTVFD API
> •From: Jevgeni Astanovski <jevgeniast@xxxxxxxxx>
> •Date: Thu, 18 Sep 2014 10:16:46 +0300
>Frank,
> After careful examining of your DISPINFOC1 program I should say that
> probably you misunderstood the idea of using user space.
> Currently your program is not simply inefficient, but it is
> "dangerously" inefficient in case you apply it to display files having
> really big number of fields.
>  ...
> So after the first call (give me first) you fill the user space by a
> number of FieldData_t structures (for all fields). And put the 2
> integers in the beginning appropriately. Then you send out the first
> structure and increment the pointer to the first unsent structure.
> When you get "give me next" call, you do not call QDFRTVFD any more!
> You rather get the user space and send away the first unsent structure
> and increment the pointer. If the pointer to the next reached the end,
> you inform the caller about that with the last structure.
> This is one of the possible solutions using user space.
-- 
This is the Bare Metal Programming IBM i (AS/400 and iSeries) (C400-L) mailing list
To post a message email: [email protected]
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/c400-l
or email: [email protected]
Before posting, please take a moment to review the archives
at http://archive.midrange.com/c400-l.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.