Page 1 of 1

Soft Enter and Function Keys Pressed

Posted: Thu Oct 27, 2022 6:56 pm
by bbunney
Is there a way for a RPGLE program that is sitting on display file record format read statement to cause the enter key or a function key to be pressed programmatically or a way of getting the program off the read statement to the next executable statement? Thanks!

Re: Soft Enter and Function Keys Pressed

Posted: Thu Oct 27, 2022 7:04 pm
by Scott Klement
What you can do is attach the display file to a data queue, and in the DDS record format put both FRCDTA and INVITE keywords. The RPG program will do a WRITE to the display file, causing the user to see the screen and be able to type.

However, instead of calling READ, wait on the data queue. If the user submits the screen, there will be an entry on the data queue, so it will receive it, and can do the READ to get the field values.

But you can time out the data queue (or just poll for new entries ratehr than waiting on it) and the RPG program can regain control while the screen is still being displayed. If you wanted to cancel the existing screen, just write a new one.

Re: Soft Enter and Function Keys Pressed

Posted: Thu Oct 27, 2022 7:09 pm
by ERFJR
Not sure of your app requirements but search for "display file timeout", a topic that's been explained many times in the past. Basic steps: INVITE in your DSPF, WRITE the record in your program, READ the record in your program, monitor for status 01339 to indicate "no input received", and so on.

Re: Soft Enter and Function Keys Pressed

Posted: Thu Oct 27, 2022 8:32 pm
by bbunney
Thank you Scott. I appreciate it.

Re: Soft Enter and Function Keys Pressed

Posted: Thu Oct 27, 2022 8:42 pm
by bbunney
ERFJR, I have a program that starts and stops HTTP server instances and I have a 4 second delay when a STRPCPSVR or ENDTCPSVR command is run and wanted to display a window for 4 seconds that the command was being processed and have it disappear on it's own without any user intervention.