|
Adam, The most obvious would be the following: pFeedback = _Rreadk(pFile, pRecBuffer ,nRecLength, __KEY_EQ, pKey->Seq, 4); Which is exactly the same, as what you did - in this particular case. Not absolutely sure, what would happen with your program in case seq in the your PF is not decimal(7,0) but rather decimal(9,0). Because decimal(7,0) occupies 4 bytes. And probably this will be the size of your structure SXKey. But what will be the size of structure, keeping decimal of size 5 bytes? Anyway, manual states, that key type is void. For me that means, that is treated as void. So I see no reason to send structure to it. As far as my experience says, PF do not keep any padding spaces, so probably structures must be unaligned (packed). Jevgeni. > -----Original Message----- > From: Adam Walker [mailto:adamwalker79@xxxxxxxxxxx] > Sent: Monday, January 10, 2005 12:59 PM > To: c400-l@xxxxxxxxxxxx > Subject: RE: [C400-L] using _Rreadk with a partial key - any examples? > > > I tried setting the other fields to blank or 0, but no joy. > So i've removed those fields from the struct and just kept > the seq. The key length is set to the struct size. this > approach seems to work well. > > thanks for your help guys. > > solution: > > typedef struct { > decimal(7,0) seq; > //char sCus[6]; > //char sCLC[3]; > //char cPrime; > } SXKey; > > .... > .... > > char* pKeyBuffer = malloc(sizeof(SXKey)); > SXKey* pKey = (SXKey*) pKeyBuffer; > int nKeyLength = sizeof(SXKey); > pKey->seq = 28; > > .... > .... > > pFeedback = _Rreadk(pFile, > pRecBuffer,nRecLength,__KEY_EQ,pKeyBuffer,nKeyLength); > > > > > --------------------------------- > ALL-NEW Yahoo! Messenger - all new features - even more fun! > _______________________________________________ > This is the C programming iSeries / AS400 (C400-L) mailing list > To post a message email: C400-L@xxxxxxxxxxxx > To subscribe, unsubscribe, or change list options, > visit: http://lists.midrange.com/mailman/listinfo/c400-l > or email: C400-L-request@xxxxxxxxxxxx > Before posting, please take a moment to review the archives > at http://archive.midrange.com/c400-l. > >
As an Amazon Associate we earn from qualifying purchases.
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.