Crappy old sockets program. Sits running all day. This is code from 2003, and probably was copied from somewhere. You don't have to do all that *IN98 stuff for sure. Have something like this in your main loop. Make sure that the loop runs at least something less that the ending time on the pwrdwnsys.
* .if select timed out - restore readset and reenter the loop
* (there is no incoming request waiting)
c If Rc = 0
c Eval *In98 = %Shtdn
c If *IN98 = *ON
* .close all sockets (disconnecting them)
c 0 Do Curmax J
c If Sckflags(J + 1) = '1'
c Callp Close(J)
c Endif
c Enddo
* .end the server program
c Eval *INLR = *ON
c Callp Log('Controlled end')
c Return
c Endif
c Iter
c Endif
On Thu, 2021-06-03 at 09:42 -0600, Javier Sanchez wrote:
I'm sure this is an old subject, but I never had the time to implement it.
I need to have the opportunity to do some graceful updates to a table in a
looping socket RPG program that will end when it receives an indication to
terminate. This updates a flag in a table to report that its status is
Ended. So this program does end gracefully. It also has formal commands
to start it and to end it.
But when an IPL is needed, the operator simply forgets to issue those
commands and the ending is abrupt, so the update of the status doesn't take
place.
I understand that the ENDJOB command for a job running an RPG program would
send a TERM signal to the program but the default handler (I think) would
simply force it to end with no chance to run a graceful subroutine that
does the update.
Can you please give me an example that does this?
Thanks.
[
https://www.medtronsoftware.com/img/MedtronMinilogo.bmp] Kevin Bucknum
Senior Programmer Analyst
MEDDATA / MEDTRON
120 Innwood Drive
Covington LA 70433
Local: 985-893-2550
Toll Free: 877-893-2550
https://www.medtronsoftware.com
CONFIDENTIALITY NOTICE
This document and any accompanying this email transmission contain confidential information, belonging to the sender that is legally privileged. This information is intended only for the use of the individual or entity named above. The authorized recipient of this information is prohibited from disclosing this information to any other party and is required to destroy the information after its stated need has been fulfilled. If you are not the intended recipient, or the employee of agent responsible to deliver it to the intended recipient, you are hereby notified that any disclosure, copying, distribution or action taken in reliance on the contents of these documents is STRICTLY PROHIBITED. If you have received this email in error, please notify the sender immediately to arrange for return or destruction of these documents.
As an Amazon Associate we earn from qualifying purchases.