Re: Check existence of data area in ILE C

Tim Bronski <[email protected]>
Newsgroups gmane.comp.lang.as400.c
Message-ID <[email protected]>
It makes no sense to me why you resolve a pointer to the data area to 
check existence but then use a retrieve api to get the contents? Why not 
just monitor for the exception on the retrieve function? You can remove 
the message in the handler using something like this:

_INTRPT_Hndlr_Parms_T *errmsg
   QMHCHGEM(&(errmsg->Target), 0, (char *)&errmsg->Msg_Ref_Key, 
"*REMOVE   ", "", 0,  errStruct);


On 3/10/2015 4:36 PM, CRPence wrote:
> On 10-Mar-2015 10:20 -0500, Zvi Kave wrote:
>> Sorry. It is too much complicated for me.
>> Waiting for simpler solution.
>> Perhaps a change in the exception handler?:
>>  #pragma exception_handler(ERROR_OCCURED, ca, 0, _C2_MH_ESCAPE, \
>>                              _CTLA_HANDLE, "MCH3401")
>>
>
>   Of course that would not resolve the issue of concurrency introduced 
> by performing a separate /check for existence/ test prior to invoking 
> the request to /Retrieve Data Area/ that itself performs the same 
> existence check.  Nevertheless...
>
>   I was unaware that the capability to suppress the messaging was 
> exposed externally in any of the HLLs, but a quick search of the 
> KnowledgeCenter revealed that there are both of the Exception Control 
> Actions available to the C language, "_CTLA_IGNORE_NO_MSG" and 
> "_CTLA_HANDLE_NO_MSG", which apparently provide the equivalent effect 
> of the message suppression:
> <http://www.ibm.com/support/knowledgecenter/ssw_ibm_i_71/rzarf/prag_exception_handler.htm%23prag_exception_handler> 
>
> "...
> ctl_action
>
>     Specifies an integer constant to indicate what action should take 
> place for this exception handler. If handler is a function, the 
> default value is _CTLA_INVOKE. If handler is a label, the default 
> value is _CTLA_HANDLE. This parameter is optional.
>
>     The following are valid exception control actions that are defined 
> in the <except.h> header file:
>
>     #define name     Defined value and action
> ...
> _CTLA_HANDLE_NO_MSG     Defined to 3. The exception is handled but 
> messages are not logged before calling the handler. The exception will 
> no longer be active when the handler gets control. Exception messages 
> are not logged. Msg_Ref_Key in the typedef _INTRPT_Hndlr_Parms_T is 
> set to zero. Exception processing ends when the exception handler 
> returns. This is valid for functions and labels.
>  ...
> _CTLA_IGNORE_NO_MSG     Defined to 132. The exception is handled and 
> messages are not logged. Control is not passed to the handler function 
> named on the directive and exception will no longer be active. 
> Execution resumes at the instruction immediately following the 
> instruction that caused the exception. This is valid for functions only.
>  ..."
>

-- 
Need secure FTP? Download your native sFTP solution here: 
www.arpeggiosoftware.com
-- 
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.