Re: _Rreadnc() and _Rwrited() from RPG

Scott Klement <[email protected]>
Newsgroups gmane.comp.lang.as400.c
Message-ID <[email protected]>
Pascal,

signals are, as far as I can tell, unrelated to what you're doing.

Signals are usually used for asynchronous notifications, for example, 
your program might be running along processing things when another job 
wants to interrupt it and tell it to quit.  A signal would be ideal here.

SIGIO is usually used in sockets programming when you want your program 
to be notified of data arriving on the socket, while it's doing 
something else.

There are a few cases in unix programming where signals are used for 
errors (those that are normally fatal) but, it's not the normal means of 
error handling -- and the _Ropen/_Rread/etc functions are not Unix 
functions, they are for IBM i only -- so it would not make sense for 
them to use signals for error handling.

Anyway...

There is a parameter to _Ropen() that controls whether programs are sent 
escape messages or not.   Take a look at the 'rtncode' parameter, here:
http://pic.dhe.ibm.com/infocenter/iseries/v7r1m0/topic/rtref/ropen.htm

Not 100% sure how it interacts with Rreadnc() since I've never used the 
recio functions with subfiles, personally.

-SK


On 1/7/2014 12:38 PM, Pascal Polverini wrote:
> Hi Buck,
>
> I get an escape message.
> I/O error CPF5037 was detected in file MYDSPF(C G D F).
>
> I have attached all the prototypes used for RPG (Rxxx_H.txt).
>
> I have also tried to add a signal() on my code but I don't know if this is
> relevant or coded properly. This (or the way it is coded) doesn't change
> anything
>
> Line added at the very beginning of the code:
> signal(SIGIO : %paddr(SignalHandler));
>
> Here the procedure:
> P signalHandler   b
> D signalHandler   pi
> D  sig                          10i 0 Value
>   /free
>    dsply ('signalHandler called');
>    return;
>   /end-free
> P signalHandler   e
>
> To test it, you simply need to run a READC without having any record
> changed in your subfile (Normally a simple Enter on a SFL display to a pgm
> that uses / checks for readc).
>
> Pascal
>
>
>
-- 
This is the Bare Metal Programming IBM i (AS/400 and iSeries) (C400-L) mailing list
To post a message email: C400-L-Zwy7GipZuJhWk0Htik3J/[email protected]
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/c400-l
or email: C400-L-request-Zwy7GipZuJhWk0Htik3J/[email protected]
Before posting, please take a moment to review the archives
at http://archive.midrange.com/c400-l.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.