CLLE Program SNDRCVF WAIT(*NO) problem

Use this board to ask questions or have discussions with other Genie users.
Post Reply
rasaro
Profound User
Posts: 60
Joined: Tue Mar 17, 2015 12:48 pm
First Name: Rick
Last Name: Asaro
Company Name: MISD
Country: United States
Contact:

CLLE Program SNDRCVF WAIT(*NO) problem

Post 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?
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: CLLE Program SNDRCVF WAIT(*NO) problem

Post 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.
rasaro
Profound User
Posts: 60
Joined: Tue Mar 17, 2015 12:48 pm
First Name: Rick
Last Name: Asaro
Company Name: MISD
Country: United States
Contact:

Re: CLLE Program SNDRCVF WAIT(*NO) problem

Post 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.
dkmccammon
Profound User
Posts: 48
Joined: Wed Apr 12, 2017 4:44 pm
First Name: Darin
Last Name: McCammon
Company Name: NAICO
Phone: 4052584301
Address 1: 1010 Manvel Ave
City: Chandler
State / Province: Oklahoma
Zip / Postal Code: 74834
Country: United States
Contact:

Re: CLLE Program SNDRCVF WAIT(*NO) problem

Post 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?
User avatar
Glenn
Profound Logic Staff Member
Posts: 124
Joined: Mon Apr 14, 2014 4:08 pm
First Name: Glenn
Last Name: Hopwood
Company Name: Profound Logic Software
State / Province: Ohio
Country: United States
Contact:

Re: CLLE Program SNDRCVF WAIT(*NO) problem

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

Who is online

Users browsing this forum: No registered users and 1 guest