In the open option string you specifically ask system not to update 
feedback area - riofb=n.

static char open_fwd_optionsÝ100¨ =  
      "rr+ blkrcd=n riofb=n arrseq=y";  

This is how this option is defined:

         Where value can be:
Y       All fields in the _RIOFB_T structure are updated by any I/O 
operation that returns a pointer to the _RIOFB_T structure. However, the 
blk_filled_by field is not updated when using the _Rreadk function. This 
is the default.
N       Only the num_bytes field in the _RIOFB_T structure is updated.

always speaking for myself only
Where is the beginning of the end, which ends the beginning?

"David C. Shea" <dshea@xxxxxxxxxxxx> 
Sent by: c400-l-bounces@xxxxxxxxxxxx
09/30/2004 04:11 PM
Please respond to
C programming iSeries / AS400

"C programming iSeries / AS400" <c400-l@xxxxxxxxxxxx>

[C400-L] Rreadl - finding last active RRN in a file

I have been playing with Rreadl lately.  Bear in mind that I'm not a C 
programmer...  RPG, yes, but not C.  But... I can cut and paste pretty 
well, and I can figure things out if I see enough examples.  It's still 
pretty much Greek to me, but it's starting to sink in.
According to the documentation I've seen, Rreadl is supposed to find the 
last active record in a file member.  When it does this, it is supposed to 
return the RRN of the record found amongst other things.
I have figured out how to execute this program, and it is, in fact, 
finding the last record in the file.  I can get the buffer of the record 
to confirm that it is, in fact, the right record.  I can get the buffer 
length from RIOFB_T, and that is correct.  So, it appears that RIOFB_T is 
getting populated with some stuff.  But... I'm not seeing anything in the 
rrn field in RIOFB_T.  For some reason it's always coming back zero.  I 
have tried printing the value with various flavors of field definitions, 
but that's not helping either.
So... either I'm doing something wrong in my program, or I'm reading the 
docs wrong and Rreadl does not, in fact, return the RRN of the record that 
it found.
Can anyone tell me what I'm doing wrong?  The last active record in the 
file is at RRN 30.
Here's the code I'm running:
#include <limits.h>  
#include <stdlib.h>  
#include <string.h>  
#include <stdio.h>  
#include <recio.h>  
#include <xxfdbk.h>  
static _RFILE *forward;  
static char open_fwd_optionsÝ100¨ =  
      "rr+ blkrcd=n riofb=n arrseq=y";  
int main(int argc, char * argvݨ)  
/*_RIOFB_T  * riofb_fwd;        */  
  _RIOFB_T  * fb;  
  _XXOPFB_T * opnfb;  
  char * file_name;  
 void ** p;  
 int i,  
 if (argc > 1)  
   file_name = argvÝ1¨; /* first parm is the file name */  
   printf("Enter file name in format LIB/FILE(MEMBER): \n");  
 /* open the file the first time to get basic information */  
 if ((forward = _Ropen(file_name,open_fwd_options)) == NULL)  
   printf("ERROR - file %s not found. \n",file_name);  
  opnfb = _Ropnfbk(forward); 
  /* position to just after last data record in the file */ 
  fb = _Rreadl(forward,NULL,0,__NO_LOCK); 
    printf("RRN: %d. \n",fb->rrn); 
    printf("RRN: %dl . \n",fb->rrn); 
    printf("RRN: %UL . \n",fb->rrn); 
    printf("RRN: %d . \n",fb->rrn); 
and here's the output I'm getting:
RRN: 0. 
RRN: 0l . 
RRN: L . 
RRN: 0 . 
Press ENTER to end terminal session. 
Go... FASTER!  Without an upgrade!  With ARCTOOLS/400(tm)
DCSoftware, Inc.
Ph: (508) 435-8243
Fax: (508) 435-4498
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,
or email: C400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives

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 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].