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



Thank you Chris.

On 11/03/2015 16:15, [1]chrish@xxxxxxxxxxxxxxxxx wrote:

Zvi

I have always steered away from the QXX API's as they are very slow, I think
I read in the manual somewhere about the reasons for the slowness but cannot
remember. I did use them very extensively for managing a repeating process
to track data elements and it was very slow and high in CPU in comparison
to the alternative which uses USRSPC and pointers to track data. The sample
I submitted was used to track journal receiver delete requirements for a
single customer, our product had work if the DA was not there hence the use
of the API (PLUS.. The QXX API's only work with character data, so I would
have to convert a character string to a number every time it was read.).

I should really set up a test and do a retrieval in a loop and look at the
CPU cycles etc for each method, one day.. I just don't use data areas much
anymore as other options are far better and much more flexible.

Chris..


-----Original Message-----
From: C400-L [[2]mailto:c400-l-bounces@xxxxxxxxxxxx] On Behalf Of Zvi Kave
Sent: March 11, 2015 3:57 AM
To: [3]c400-l@xxxxxxxxxxxx
Subject: Re: [C400-L] Check existence of data area in ILE C

Hi Chris,

I shall try it later because I need a quick solution.
In the meantime I need only to replace _CTLA_HANDLE with
_CTLA_HANDLE_NO_MSG
in the exception handler.
Do I save CPU in your solution or it is the same, but without exception
handler ?

Thanks,

Zvi

On 10/03/2015 20:10, [[4]1]chrish@xxxxxxxxxxxxxxxxx wrote:

Here is a quick sample for a data area which is a decimal data area (cannot
be retrieved using the QXX API's)

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <qusec.h>
#include <decimal.h>
#include <qwcrdtaa.h>


typedef _Packed struct DA_content_x {
Qwc_Rdtaa_Data_Returned_t hdr;
char data[10];
} DA_content_t;

int main(int argc, char **argv) {
int rcvr_count = 0;
DA_content_t Dta_Content; /* data area content */
decimal(5,0) *d_ptr;
char DA_Name[20] = "NBROFRCV CHLIB "; /* Name */
Qus_EC_t Error_Code = {0}; /* error code struct */

Error_Code.Bytes_Provided = sizeof(Error_Code);

QWCRDTAA(&Dta_Content,
sizeof(Dta_Content),
DA_Name,
1,
5,
&Error_Code);
if(Error_Code.Bytes_Available > 0) {
// do something about the error
printf("Error received %.7s\n",Error_Code.Exception_Id);
return -1;
}
printf("Available = %d\n",Dta_Content.hdr.Bytes_Available);
printf("Returned = %d\n",Dta_Content.hdr.Bytes_Returned);
printf("Type = %.10s\n",Dta_Content.hdr.Type_Value_Returned);
printf("Length = %.10s\n",Dta_Content.hdr.Length_Value_Returned);
printf("Decimal pos = %d\n",Dta_Content.hdr.Number_Decimal_Positions);
d_ptr = (decimal(5,0)*)Dta_Content.data; printf("Content =
%D(5,0)\n",*d_ptr); return 1; }

It's simple and easy to understand and does not require you to build in
your own error handler. Write it up as a generic handler for retrieving any
data area content.

Chris...

-----Original Message-----
From: C400-L [[2][5]mailto:c400-l-bounces@xxxxxxxxxxxx] On Behalf Of Zvi Kave
Sent: March 10, 2015 12:04 PM
To: [[6]3]c400-l@xxxxxxxxxxxx
Subject: Re: [C400-L] Check existence of data area in ILE C

Very nice.
_CTLA_HANDLE_NO_MSG made the trick!!

Many thanks,

Zvi

On 10/03/2015 17:36, 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:


[1][4][7]<http://www.ibm.com/support/knowledgecenter/ssw_ibm_i_71/rzarf/prag_ex
cep
tion_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.
..."

References

Visible links
1.

[5][8]http://www.ibm.com/support/knowledgecenter/ssw_ibm_i_71/rzarf/prag_except
ion
_handler.htm%23prag_exception_handler
--
This is the Bare Metal Programming IBM i (AS/400 and iSeries) (C400-L)
mailing list To post a message email: [[9]6]C400-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: [7][10]http://lists.midrange.com/mailman/listinfo/c400-l
or email: [[11]8]C400-L-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives at [9][12]http://archive.midrange.com/c400-l.

References

Visible links
1. [13]mailto:chrish@xxxxxxxxxxxxxxxxx
2. [14]mailto:c400-l-bounces@xxxxxxxxxxxx
3. [15]mailto:c400-l@xxxxxxxxxxxx
4.
[16]http://www.ibm.com/support/knowledgecenter/ssw_ibm_i_71/rzarf/prag_exception
_handler.htm%23prag_exception_handler
5.
[17]http://www.ibm.com/support/knowledgecenter/ssw_ibm_i_71/rzarf/prag_exception
6. [18]mailto:C400-L@xxxxxxxxxxxx
7. [19]http://lists.midrange.com/mailman/listinfo/c400-l
8. [20]mailto:C400-L-request@xxxxxxxxxxxx
9. [21]http://archive.midrange.com/c400-l
--
This is the Bare Metal Programming IBM i (AS/400 and iSeries) (C400-L)
mailing list To post a message email: [22]C400-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: [23]http://lists.midrange.com/mailman/listinfo/c400-l
or email: [24]C400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
[25]http://archive.midrange.com/c400-l.

References

Visible links
1. mailto:chrish@xxxxxxxxxxxxxxxxx
2. mailto:c400-l-bounces@xxxxxxxxxxxx
3. mailto:c400-l@xxxxxxxxxxxx
4. mailto:1]chrish@xxxxxxxxxxxxxxxxx
5. mailto:c400-l-bounces@xxxxxxxxxxxx
6. mailto:3]c400-l@xxxxxxxxxxxx
7. http://www.ibm.com/support/knowledgecenter/ssw_ibm_i_71/rzarf/prag_exception_handler.htm%23prag_exception_handler
8. http://www.ibm.com/support/knowledgecenter/ssw_ibm_i_71/rzarf/prag_except
9. mailto:6]C400-L@xxxxxxxxxxxx
10. http://lists.midrange.com/mailman/listinfo/c400-l
11. mailto:8]C400-L-request@xxxxxxxxxxxx
12. http://archive.midrange.com/c400-l
13. mailto:chrish@xxxxxxxxxxxxxxxxx
14. mailto:c400-l-bounces@xxxxxxxxxxxx
15. mailto:c400-l@xxxxxxxxxxxx
16. http://www.ibm.com/support/knowledgecenter/ssw_ibm_i_71/rzarf/prag_exception
17. http://www.ibm.com/support/knowledgecenter/ssw_ibm_i_71/rzarf/prag_exception
18. mailto:C400-L@xxxxxxxxxxxx
19. http://lists.midrange.com/mailman/listinfo/c400-l
20. mailto:C400-L-request@xxxxxxxxxxxx
21. http://archive.midrange.com/c400-l
22. mailto:C400-L@xxxxxxxxxxxx
23. http://lists.midrange.com/mailman/listinfo/c400-l
24. mailto:C400-L-request@xxxxxxxxxxxx
25. http://archive.midrange.com/c400-l

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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.