Identifying the server at run time

You can request the location name of the system to which you are connected.

About this task

The special register CURRENT SERVER contains the location name of the system you are connected to. You can assign that name to a host variable with a statement like this:
EXEC SQL SET :CS = CURRENT SERVER;