Re: C program for QDFRTVFD API
Jevgeni Astanovski <[email protected]>
| Newsgroups | gmane.comp.lang.as400.c |
|---|---|
| Message-ID | <CAJuVQr3XLGr2hZLVkrmyCT9cb698zEDwPsJVGLUD_ChxkCf9Gg@mail.gmail.com> |
I meant different thing. I would retrieve QDFTRTVD API data into an allocated memory chunk. Then I would create user space to keep retrieved structures in a format of FieldData_t format. I would place two integers in the beginning of the user space that are length of the data in the user space and offset to the first unsent field in the user space. Then I would return first retrieved field from the user space and increment a pointer to the next one. When called wit "NEXT" I would just return a field pointed by my "next" pointer in the user space and increment it. In this case you also do not need to pass previous field when requesting next. By the way, after analyzing and debugging your program I've got mine working as well. I've caught the logic of "Where Used" fields and now it works fine in my program. On Fri, Sep 19, 2014 at 10:04 AM, Frank Kolmann <[email protected]> wrote: > 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 > > -- This is the Bare Metal Programming IBM i (AS/400 and iSeries) (C400-L) mailing list To post a message email: C400-L-Zwy7GipZuJhWk0Htik3J/[email protected] To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/c400-l or email: C400-L-request-Zwy7GipZuJhWk0Htik3J/[email protected] Before posting, please take a moment to review the archives at http://archive.midrange.com/c400-l.