Programs can terminate an IBM i session with the ENDSESSION UDF. The syntax of the UDF is:
UDF ('MGEAC32.ENDSESSION', A)
Where: A = server name