|
"Richard Hartman" <r_hartman@hotmail.com> wrote: > Mr. Scott Klement > > Thank you for your information, it sounds close to what I want to do > I just have one more question that I would like to ask you. > > If I compile the DSPF with WAITRCD of one minute, (that would be out > generic timeout). Then inside the program lets say that I have > a certain user is allowed five minutes(passed in parm). The > program would read the data queue and after one minute my DSPF > would send a timeout value to the data queue. > Except that my certain user is allowed five minutes. Would I have to > go into a loop and re-read the data queue, and would I write the > record form or read the DSPF until my five minutes are up? I would > not prefer to keep writing the record format, because of causing > a screen flicker. I cant use the CHGDSPF command, because I would > be affecting the object for all of the users. Okay, given this type of scenario, just forget about the WAITRCD parameter on the display file... Leave it at *NOMAX, we won't even use WAITRCD at all, we'll do it entirely with data queues! The record format will use the DDS keyword "FRCDTA" to make it display immediately when we WRITE it from our RPG program. Then, we'll also use the INVITE keyword. This allows the user to type into the record format -- even though we havent issued a "READ" to the screen yet. When the user finally does hit enter or a function key, an entry will be placed into the data queue. We'll simply do our timeout by waiting for an entry to appear in the data queue for a certain number of seconds (which could be supplied as a variable) and not read the screen unless we actually DID see a function key or ENTER pressed. > > Any help would be appreciated. > Could you send me some of your example code, maybe that would clear > things up better. > Thank you, > Richard Hartman > Email: richard.hartman@brctsg.com > Okay, at the bottom of the message, will be some example code. There will be 2 source members... DDS for the display file, and RPG for the actual program logic. To run the example, compile the display with: CRTDSPF FILE(MYDSPF) SRCFILE(xxx/xxx) compile the RPG with: CRTBNDRPG PGM(MYPGM) SRCFILE(xxx/xxx) DFTACTGRP(*NO) ACTGRP(*NEW) and then just call the program. Heres the example DDS: A DSPSIZ(24 80 *DS3) A R SCREEN1 A INVITE A FRCDTA A 9 17'There is a timeout on this- A screen. Press ENTER' A 10 27'or wait for it to time out.' A MSG 50 O 14 16 Here's the example RPG: FMYDSPF CF E WORKSTN USROPN D RunCmd PR EXTPGM('QCMDEXC') D Cmd 200A CONST D Len 15P 5 CONST D RcvDtaQ PR EXTPGM('QRCVDTAQ') D dqname 10A CONST D dqLib 10A CONST D dqLen 5P 0 D dqData 80A D dqWait 5P 0 CONST D DQLen S 5P 0 D TimeOut S 5P 0 D DQData S 80A C* create a data queue in QTEMP. c callp RunCmd('CRTDTAQ DTAQ(QTEMP/TESTDQ) - c MAXLEN(80) SEQ(*FIFO)': 200) C* Make the display file use the new data queue c callp RunCmd('OVRDSPF FILE(MYDSPF) DTAQ(' + c 'QTEMP/TESTDQ)': 200) C* open the display file. c open MYDSPF C* Show the screen the user. This format has the C* "FRCDTA" keyword so the screen will show up immediately, and the C* "INVITE" keyword so the keyboard isn't locked. c write Screen1 C* Wait for one of two conditions... C* 1) an entry to appear on the data queue or C* 2) A timeout while waiting for the data queue. c eval DQLen = 80 c eval Timeout = 10 c callp RcvDtaQ('TESTDQ':'QTEMP': DQLen: DQData: c Timeout) C* Show the results... (if Len=0, no data was received...) c if dqLen = 0 c eval Msg = 'TIMEOUT! Press ENTER to quit.' C else c read SCREEN1 999 c eval Msg = 'ENTER! Press ENTER again to quit c endif c write SCREEN1 C* Wait "forever" for enter to be pressed, this time. C* (Timeout=-1 means that it'll never timeout) c eval Timeout = -1 c callp RcvDtaQ('TESTDQ':'QTEMP': DQLen: DQData: c Timeout) c read SCREEN1 999 C* Do some cleanup and end... c close MYDSPF c callp RunCmd('DLTOVR FILE(MYDSPF)':200) c callp RunCmd('DLTDTAQ DTAQ(QTEMP/TESTDQ)':200) c eval *inlr = *on +--- | This is the RPG/400 Mailing List! | To submit a new message, send your mail to RPG400-L@midrange.com. | To subscribe to this list send email to RPG400-L-SUB@midrange.com. | To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.com +---
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.