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")
Regards,
Zvi
On 10/03/2015 16:54, CRPence wrote:
On 10-Mar-2015 03:27 -0500, Zvi Kave wrote:
On 16/12/2014 11:18, Zvi Kave wrote:
On 15/12/2014 20:14, Jevgeni Astanovski wrote:
On Mon, Dec 15, 2014 at 6:52 PM, Zvi Kave wrote:
My ILE C program crashes in the line of QXXRTVDA if data does
not
exist.
Is there a way to avoid this crash ?
Someone has an example code for this?
The line is like this:
QXXRTVDA(dta, 41, 5, user_dta);
and I got program crash with the message:
"Data area DTA in QGPL not found."
If data area dta exists, it works fine.
I use a function Check_DAARA before calling RTVDTAARA:
int Check_DTAARA(char *dtaname, char *dtalib)
{
_SYSPTR p;
volatile _INTRPT_Hndlr_Parms_T ca; /* communications area */
#pragma exception_handler(ERROR_OCCURED, ca, 0, _C2_MH_ESCAPE,
\
_CTLA_HANDLE, "MCH3401")
p = rslvsp(WLI_DTAARA, dtaname, dtalib, 0x0190);
return 0;
ERROR_OCCURED:
return -1;
}
Returns 0 if data area exists, otherwise -1.
Requires some includes.
Can be used as a generic exception handler.
It is actually made of an example in one of the manuals (ILE/C
programmers's guide or alike).
I tried this function and it works fine!
I only added these 2 includes:
#include<except.h>
#include<mih/rslvsp.h>
I realized that every call to Check_DTAARA when data area not
exists, creates error lines in job log like this (which almost fired
me out):
msg MCH3401: "Cannot resolve to object DTANAME. Type and Subtype
X'190A' Authority X'0000'.
Do you have quick solution to avoid of message in job log ?
The exception causes a message, and that message can optionally be
removed. For example, the "Message Action" argument of the Receive
Program Message (QMHRCVPM) API can be set to '*REMOVE' to request that
the API remove the Escape message that was just handled.
However if that is done, then using a /check existence of data area/
preceding the request to retrieve the data seems folly; likely both
coding the exception_handler for the effectively identical condition and
dealing with the messaging from the code in the OP is sufficient.
Inserting the Rslvsp before the QXXRTVDA allows a window of opportunity
for concurrent operations [e.g. Delete Data Area (DLTDTAARA)] to occur
that would give rise to effectively the same error seen originally; i.e.
a check for existence in one instant is not preventive to a lack of
existence an instant [or anytime] later. Probably just best to code the
call to the /Retrieve Data Area/ [e.g. QXXRTVDA or QWCRDTAA] in a
presumed-success manner, asking to access the data area or perhaps to
inform of the condition of the absence, thus eliminating the window of
opportunity for the identical problem that was described in the OP.
The following link has an example of QMHRCVPM API being invoked, but
with the Message Action defined _to mark the message_ as /old/ instead
of _removing_ the message; the next link is to that API for which the
#include <qmhrcvpm.h> would be coded to access the definition from
QSYSINC/H:
[1]<
http://www.ibm.com/support/knowledgecenter/api/content/ssw_ibm_i_71/apiref/apiexdirep.htm>
[2]<
http://www.ibm.com/support/knowledgecenter/ssw_ibm_i_71/apis/QMHRCVPM.htm>
References
Visible links
1.
http://www.ibm.com/support/knowledgecenter/api/content/ssw_ibm_i_71/apiref/apiexdirep.htm
2.
http://www.ibm.com/support/knowledgecenter/ssw_ibm_i_71/apis/QMHRCVPM.htm
As an Amazon Associate we earn from qualifying purchases.