Page 1 of 1

CLLE Program SNDRCVF WAIT(*NO) problem

Posted: Fri Sep 18, 2015 12:09 pm
by rasaro
We have several CLLE programs that use the SNDRCVF WAIT(*NO) option to validate things like the file exists or the member exists before allowing the user to continue. If the file and member exist, we continue on to submit the job for batch processing. If it does not exist or if there is a file lock situation we redisplay the screen and alert the user. This is not working in Genie. The screen just sets there. Any suggestions?

Re: CLLE Program SNDRCVF WAIT(*NO) problem

Posted: Fri Sep 18, 2015 5:47 pm
by Scott Klement
Yes... this is expected.

There's no way for the IBM i to send data to the web browser unless the web browser requests it. We can't send a screen unless the user types data and submits it... so the way it works, when they put in the URL and submit that, we do all the processing needed until the user gets asked for input. Then we send everything to the browser, etc. Then control sits in the browser until that screen is submitted, and we do all the processing until the user is asked for input again, etc.. this keeps going through the whole session...

So you see, there's no way the server (RPG or CL program or whatever) can display a screen and just continue running. To do that, we'd have to send the screen but then go back to the program immdiately without the user submitting anything, or we'd have to be able to send a new screen while the user is sitting there looking at the screen before it... neither of these are possible with a web browser. (Well, there are new technologies like WebSockets that can do that, but these weren't around when Genie was written, and they still aren't supported everywhere.)

However, there is a very easy workaround. You can put JavaScript on a screen so that it can "submit itself".

For example, in the "onload" event of a screen, you could put this:

Code: Select all

setTimeout( function() { pressKey("ENTER"); }, 500);
This tells it to press the ENTER key after 0.5 second delay. That way, the CL program can do a normal SNDRCVF (and wait for response) The screen will be sent back to the program in 1/2 second (or you can use 250 for 1/4 second, etc) and it'll work very close to the way things worked with 5250. But, since the screen is submitted by the browser in this case (albeit, by a script in the browser) we bypass the limitation...

Hope this doesnt' seem too long-winded. I wanted to help you understand the issue... Let us know how this works for you.

Re: CLLE Program SNDRCVF WAIT(*NO) problem

Posted: Tue Sep 22, 2015 7:37 am
by rasaro
We decided to change the CLLE programs to not use this processing method anymore. We were using this in conjunction with the SNDPGMMSG command to give feedback to the user on the screen but this command is not working in the browser either. Thanks Scott.

Re: CLLE Program SNDRCVF WAIT(*NO) problem

Posted: Mon Nov 27, 2017 11:26 am
by dkmccammon
Scott, my fear in using the setTimeout( function() { pressKey("ENTER"); }, 500); is, if the user pauses for half a second or whatever time interval we pick, and they have typed in updated information that gets changed/updated/submitted as batch job, or any other functionality by pressing the Enter key, but have not completed updating the fields on the screen, then a "false" batch job or what have you may be submitted prematurely causing issues.

The other thing to mention on this set time out function is that it causes the screen to "blink" every half second, or however long the time interval is that we set. Which from my testings thus far is somewhat annoying.

Is there another workaround to get a message to the user, other than e-mail, that is similar to the green screens SNDBRKMSG?

Re: CLLE Program SNDRCVF WAIT(*NO) problem

Posted: Mon Nov 27, 2017 3:51 pm
by Glenn
Darin,

We do offer an alternative to the SNDBRKMSG command. It's called PUISNDMSG.

http://www.profoundlogic.com/docs/displ ... k+Messages

Glenn