Soft Enter and Function Keys Pressed

Discussions relating to writing software in ILE RPG (RPG IV). This includes both fixed and free format RPG.
Post Reply
bbunney
Posts: 47
Joined: Wed Jul 06, 2022 7:52 pm

Soft Enter and Function Keys Pressed

Post 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!
Scott Klement
Site Admin
Posts: 736
Joined: Sun Jul 04, 2021 5:12 am

Re: Soft Enter and Function Keys Pressed

Post 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.
ERFJR
Posts: 2
Joined: Thu Jul 29, 2021 6:42 am

Re: Soft Enter and Function Keys Pressed

Post 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.
bbunney
Posts: 47
Joined: Wed Jul 06, 2022 7:52 pm

Re: Soft Enter and Function Keys Pressed

Post by bbunney »

Thank you Scott. I appreciate it.
bbunney
Posts: 47
Joined: Wed Jul 06, 2022 7:52 pm

Re: Soft Enter and Function Keys Pressed

Post 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.
Post Reply