Here's my 10 eurocents:

memcpy(CPNC, "123456", 6) ;
found = 0 ;
rfp = _Rreadk(fp, &Account, sizeof(scpf), __KEY_EQ, CPNC, 6) ;
while (rfp->num_bytes == sizeof(scpf) && found == 0)
{
  if (!memcmp(Account.SCCCY, "EUR", 3))
    found = 1;
  if (!found)
    rfp = _Rreadk(fp, &Account, sizeof(scpf), __KEY_NEXTEQ, CPNC, 6) ;
}


> -----Original Message-----
> From: Ulrich, Kent [mailto:Kent.Ulrich@xxxxxxxxxxxxxxx]
> Sent: Friday, January 07, 2005 2:24 PM
> To: C programming iSeries / AS400
> Subject: RE: [C400-L] using _Rreadk with a partial key - any examples?
> 
> 
> Here is a code sample of how I normally do it.
> 
>  PRPPRFL1Key.PPGREF = GroupRefNumber;                  
>  PRPPRFL1Key.PPVRSN = 0;                               
>  PRPPRFL1IOFeedback = _Rreadk(PRPPRFL1,                
>                              &PRPPRFL1RecStruct,       
>                              sizeof(PRPPRFL1RecStruct),
>                              __KEY_GE,                 
>                              &PRPPRFL1Key,             
>                              sizeof(PRPPRFL1Key));
> 
> Kent
>     
> 
> -----Original Message-----
> From: Ulrich, Kent 
> Sent: Friday, January 07, 2005 6:46 AM
> To: C programming iSeries / AS400
> Subject: RE: [C400-L] using _Rreadk with a partial key - any examples?
> 
> 
> To read using a partial key the remaining fields of the key 
> structure need to be set to zero or blanks (or whatever is 
> the 'base' value for each field).
> For example, if the key is 3 numeric fields and you want the 
> first record matching the first field of the key, set the 2nd 
> and 3rd field in the key structure to zero.
> 
> Kent
> 
> 
> -----Original Message-----
> From: Adam Walker [mailto:adamwalker79@xxxxxxxxxxx]
> Sent: Friday, January 07, 2005 5:50 AM
> To: c400-l@xxxxxxxxxxxx
> Subject: [C400-L] using _Rreadk with a partial key - any examples?
> 
> 
> Hi there,
>  
> I am accessing a logical file keyed over the first four 
> fields.  however, I only know the first field of the key that 
> I need to access.  This field is a unique seq number so 
> should be sufficient to locate the correct record, and the 
> documentation for _Rreadk states it can use a partial key, 
> but I am not able to successfully retrieve a record unless I 
> build the complete key (which I can do in test, but not reality).
> Ideally there would be a logical keyed over just the unique 
> seq number, but there isn't and I don't want to add one 
> unless theres no other way.
>  
> Is there anyone out there who has used _Rreadk with a partial 
> key successfully?  would you mind providing an example of how 
> the key was built (compared to a complete key) and the _Rreadk params?
>  
> thanks to anyone who can help,
>  
> - Adam
> 
>               
> ---------------------------------
>  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.
> 
> 
> _______________________________________________
> 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.
> 
> 
> _______________________________________________
> 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.
> 
> 


This thread ...


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

This mailing list archive is Copyright 1997-2019 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].