What I can advise you for test purpose is following:

.......
char Key[20];
.....
memcpy(Key, &keyflds.key1, 4) ;
memcpy(&Key[4], &keyflds.key2, 4) ;
memcpy(&Key[8], keyflds.key3, 2) ;
fb = _Rreadk(fp, &buf, sizeof(buf), __KEY_EQ, Key, 10);

if this does not work, try following:
Make a test program with _Rreadf instead of _Rreadk.
You will get buf hopefully. Compare what you see in buf to what you assume to be in Key with debugger...



-----Original Message-----
From:
c400-l-bounces+jevgeni.astanovski=sampopank.ee@xxxxxxxxxxxx
[mailto:c400-l-bounces+jevgeni.astanovski=sampopank.ee@midrang
e.com]On Behalf Of Olsson Erik
Sent: Wednesday, July 30, 2008 11:22 AM
To: C programming iSeries / AS400
Subject: Re: [C400-L] Rreadk problem


Thanks for your reply. I'm just assigning values for test purposes and
here's what I have in debug. It looks like ints:

EVAL *inkey
(*inkey).key1 = 1000
(*inkey).key2 = 233924
(*inkey).key3 = SPP:C7F91FEE0A002278

Key3 is "CA".
I have also tried having the key struct defined as _Packed
but still no
luck.

2008/7/30 Jevgeni Astanovski <Jevgeni.Astanovski@xxxxxxxxxxxx>

Looking at the values you assign, I would also think, that
you actually
have
char key1[4] and char key2[6]...
All other looks very nice, though slightly too complicated,
but that does
not matter.
I've just checked the manual for the meaning of riofb=N.
It should work, as in this case only num_bytes is updated.

-----Original Message-----
From:
c400-l-bounces+jevgeni.astanovski=sampopank.ee@xxxxxxxxxxxx

[mailto:c400-l-bounces+jevgeni.astanovski<c400-l-bounces%2Bjev
geni.astanovski>
=sampopank.ee@midrang
e.com]On Behalf Of Olsson Erik
Sent: Tuesday, July 29, 2008 6:06 PM
To: c400-l@xxxxxxxxxxxx
Subject: [C400-L] Rreadk problem


I'm trying to read an index with Rreadk, but I keep getting
no bytes in
return. The record exists and the values looks ok to me in
debug. Anybode
see what I'm missing?

typedef struct {
int key1;
int key2;
char key3[2];
} mykey;

mykey keyflds;
mykey *inkey;

//file opening etc, and then...
if ((fp=_Ropen("*LIBL/MYINDEX", "rr, riofb=N")) == NULL)
return -1;

keyflds.key1 = 1000;
keyflds.key2 = 233924;
memset(keyflds.key3, ' ', sizeof(keyflds.key3);
memcpy(keyflds.key3, "CA", 2);

inkey = &keyflds;

fb = _Rreadk(fp, &buf, sizeof(buf), __KEY_EQ, inkey, 10);

Best wishes,
Erik
--
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-Ups:
Replies:

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 here. If you have questions about this, please contact [javascript protected email address].