|
Hi Aaron, You got it with "Or is that where the 'wait time' parm comes in?" When your program is sitting on the CALL to QRCVDTAQ, it will always process a data queue entry as soon as it arrives. If no entry arrives within the 'wait time', it will continue processing with the stmt following the CALL. At that point, as you're doing in your code, you check dqLen. If it's zero, there was no entry on the data queue, and you can do something else, or loop back and wait some more. While your program is waiting, it is not using any processor time, similar to the C "sleep" function. hth, Peter Dow Dow Software Services, Inc. 909 793-9050 voice 909 522-3214 cellular 909 793-4480 fax ----- Original Message ----- From: "Bartell, Aaron L. (TC)" <ALBartell@taylorcorp.com> To: <rpg400-l@midrange.com> Sent: Tuesday, July 23, 2002 3:17 PM Subject: QRCVDTAQ (Receive Data Queue) program > Hi all, > > I am working on a program that needs to wait for entries to be put into a > user defined data queue and process them. I have read how data queues work > but I am confused on some things. What would I specify for a wait time if I > wanted to process a queue entry as soon as it hits the data queue? > > Also, once I have my program done that calls API QRCVDTAQ do I just submit > it to batch and let it run? It seems that it would just loop and take up a > lot of processor time?? Or is that where the 'wait time' parm comes in? > > Here is an example of what I am talking about concerning it just looping and > taking up processor time: > > D dqName s 10 inz('JMDTAQ') > D dqLib s 10 inz('QGPL') > D dqLen s 5 0 inz(10000) > D dqData s 10000 > D dqWait s 5 0 inz(5) > > D from S 50 > D to S 50 > D replyTo S 50 > D subject S 50 > D filename S 100 > D text S 32767 > D rtnCode S 3 > D rtnText S 50 > > /FREE > dow 'something' <> 'somethingelse'; > exsr $qRcvDtaQ; > > if dqLen > 0; > from = 'heyYou@home.com'; > to = 'snoopy@loopy.com'; > replyTo = 'bartell@homeless.com'; > subject = 'JavaMail from Aaron Bartell'; > text = 'This is the body of the email'; > exsr javaMail; > endif; > enddo; > > *inlr = *on; > /END-FREE > C $qRcvDtaQ begsr > C call 'QRCVDTAQ' > C parm dqName > C parm dqLib > C parm dqLen > C parm dqData > C parm dqWait > C endsr > C javaMail begsr > C call 'JAVAMAIL' > C parm from > C parm to > C parm replyTo > C parm subject > C parm text > C parm filename > C PARM rtnCode > C PARM rtnText > C endsr > > Thanks in advance, > Aaron Bartell > _______________________________________________ > This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list > To post a message email: RPG400-L@midrange.com > To subscribe, unsubscribe, or change list options, > visit: http://lists.midrange.com/cgi-bin/listinfo/rpg400-l > or email: RPG400-L-request@midrange.com > Before posting, please take a moment to review the archives > at http://archive.midrange.com/rpg400-l. > >
As an Amazon Associate we earn from qualifying purchases.
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.