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



Hi everyone,

I am using _Rxxx C functions from RPG for a display file.
It all looks good but I am having an issue with the C function _Readnc()
that generates an error any time there is no subfile record changed.
Unfortunately I am not familiar to C code. I have tried different things
and don't understand what to do at this point. I was wondering if you could
help me or direct me to the right resource.

In my test, I can see the subfile, exit, select a subfile-row and get the
detail screen but it crashes when there is no (or no more) subfile changed
record.

- In my understanding the Rreadnc() (Extproc('_Rreadnc')) should simply run
and return -1 (EOF) on the RIOFB.num_bytes subfield if there is no changed
record on the subfile. When there is a changed record I can see a correct
value in RIOFB.num_bytes.

- The way I do the OPEN might also be the cause? (I tried with option 'rr+
rtncode=y': same result, but from the doc I read that rtncode doesn't
affect dspf).
- I read the doc and read about the signal() function, would this
monitor/ignore the err-msg? (like a MONMSG in CLP) but I won't know how to
declare and code it.

Another issue I encounter is in the write Subfile when the number or rows
reaches the SFLSIZ limit: I/O error CPF5003.

Here the RPG code I am using:

d RIOFB ds likeds(RIOFB_T) based(pRIOFB)
D pRvoid s *
D pRFile s *
D myPointer s *
/free
if operation = 'OPEN';
myPointer = Ropen('MYLIB/MYDSPF':'rr+');
...
elseif operation = 'WRITE';
if isSFL;
pRvoid = Rformat(myPointer:'MYSFL');
pRFile = Rwrited(myPointer:myOutputBuffer
:myOutputBufferLen
:myRrn);
else;
...
endif;
...
elseif operation = 'READC';
pRvoid = Rformat(myPointer:'MYSFL');
monitor;
pRIOFB = Rreadnc(myPointer:myInputBuffer
:myInputBufferLen);
on-error;
myEof = '1';
endmon;
// RIOFB.num_bytes = -1 means EOF
if RIOFB.num_bytes = myInputBufferLen;
myRrn = RIOFB.rrn;
else;
myEof = '1';
endif;
...

- When some subfile row are changed it works OK but when there is no (or
not anymore) subfile row changed Rreadnc throws an I/O error CPF5037
despite the monitor instruction.
- When the number of rows (myRrn) is greater than SFLSIZ (describe in
theSFLCTL)
Rwrited throws an I/O error CPF5003.

Thanks in advance for any help!
Pascal

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.