× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



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,                                                                         
 
     j;                                                                         
 
                                                                                
 
 if (argc > 1)                                                                  
 
 {                                                                              
 
   file_name = argvÝ1¨; /* first parm is the file name */                       
 
 }                                                                              
 
 else                                                                           
 
 {                                                                              
 
   printf("Enter file name in format LIB/FILE(MEMBER): \n");                    
 
   gets(file_name);                                                             
 
 }                                                                              
 
                                                                                
 
 /* 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);                           
 
   exit(EXIT_FAILURE);                                                          
 
 }                                                                              
 
                                                                       
  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);                                    
  _Rclose(forward);                                                    
  exit(EXIT_SUCCESS);                                                  
}                                                                      
 
 
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)
http://www.arctools.com
info@xxxxxxxxxxxx 
DCSoftware, Inc.
Ph: (508) 435-8243
Fax: (508) 435-4498
++++++++++++++++++++++++++++++++++++++++++++

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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

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.