GDA and SUBPROGRAM Invoked by Broker/RPC

We have a subprogram with the following data definition (+FUNC is defined in COMMON):

define data global using COMMON
1 #parm (a10)
write "before assign value: " +FUNC
if +FUNC eq ’ ’
move “N” to +FUNC
write "after assigning value: " +FUNC
move “finished testing” to #parm

This subprogram is called from a java client via Broker/RPC Service.

When we 1st run the java program, we notice the output in the RPC Server log as follows:
before assign value:
after assigning value: N

That is expected.

We then run the java program a second time. Instead of seeing +FUNC being blank in the before assigned value, we see:
before assign value: N
after assigning value: N

That was a little surprising since both java executions are not related. They each do a broker logon and a broker logoff.

Why is the +FUNC value from the 1st java execution got carried over to the 2nd java execution?

Please advise. Thanks!

Your Java executions are not related, but I guess they still hit the same RPC server instance,
much like what happens when invoke the same program 2 times from your terminal session,
you will then see the GDA value set by the first invocation the 2nd time around.

When your RPC subprogram absolutely has to use GDA variables then use


either when you enter the subprogram or before you exit it, just to clean up.


I understand now. The LOGONRQ merely says that logon data is required to be sent with rpc server request. It does not mean that an implicit logon to the natural library is done. This would explain the active state of the global variables across all rpc requests of the same rpc server.

As always, many thanks for the enlightened explanation.