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



This one perhaps:

https://www.ibm.com/docs/en/i/7.1?topic=queues-example-in-ile-c-using-data

Your example is for Client Access/IBM Access APIs.

I just googled: QSNDDTAQ C example

Have fun !

Regards,
Richard Schoen
Web: http://www.richardschoen.net
Email: richard@xxxxxxxxxxxxxxxxx

----------------------------------------------------------------------

message: 1
date: Tue, 14 Dec 2021 10:37:51 +0100
from: Patrik Schindler <poc@xxxxxxxxxx>
subject: [C400-L] Using Data Queues in C, with V4

Hello,

I'm preparing to (hopefully) get some stuff done in the upcoming holidays. :-)

Some background information for the curious ones:

One of that stuff is a metering project. I have meters for (parts of) my house's power consumption, generating a pulse on output pins after a fixed amount of energy (Watts per hour) have passed. The meter is connected to a small appliance with 12 independent input pins. This generates an UDP packet to a configurable IP address containing the current state of the inputs encoded as bits in a word (16 Bits). For every pulse, two packets are generated: One for the input being set high, and one for being set low after a very short time. By measuring the time between two 0->1 pulses per input, I can calculate the average power consumption in Watts between two pulses. This code is done, and already works well on a x86 Linux server at my home, but I want to give my 150 more meaningful work and thus port that stuff to OS/400. :-)

The frequency of 0->1 pulses can easily reach 2..3 per second, which means that Wattage calculation and (temporary) saving of the values needs to be done with very high efficiency/the least amount of work, given the challengingly limited CPU horse power of the 150. Because any delay (or variation of delay) in calculation means falsified Watt values being calculated, this task should be very small and run with the highest scheduling priority possible. I'll take care of that with a separate SBS (for an ASJ), JOBD and CLS objects.

I have tested a port of that C application to OS/400, just printing calculated watt values to stdout. Comparing the output from Linux and OS/400 in the 5250 session, they are mostly the same with only tiny deviations.

To keep the amount of work for saving values low, I want to write those values to a data queue, from within that C application, and run a low priority copy application from time to time, to move the data queue contents to the final PF for further handling.

I found an example on the IBM web page:

https://www.ibm.com/docs/en/i/7.4?topic=apis-example-using-data-queues

Unfortunately, there is no include file <iostream>, nor "cwbdq.h" in V4R5. So the shown cwbDQ_* API calls for handling data queues are unavailable.

Questions:
- Does anybody know of a *working* example for handling data queues from C in V4?
- What would be a useful "trigger" to make the mentioned copy-task run? This question isn't necessarily related to C, though. But given the context I'm providing, it makes sense to ask it here, too.

Thanks!

:wq! PoC


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.