db2 cross platform function/variable?
It's a very open-ended question, as there is no sure-fire method to determine the server version and platform. You'll need to apply some heuristics.

In Db2 for LUW (and only LUW) since v 10.1 there's a system view dbmcfg that can return the server version:

select value from sysibmadm.dbmcfg where name = 'release'


so if it succeeds you'll be sure it's Db2 for LUW of certain release level. Similarly, since v 9.7 you can query sysibmadm.env_inst_info (or first search for it in syscat.tables).

Another indicator of Db2 for LUW is the presence of some Oracle-compatible views since v.9.7, e.g. syspublic.dual or sysibmadm.all_objects.

A good indicator of Db2 for z/OS would be the presence of mainframe-specific catalog tables, e.g. sysibm.locations or sysibm.syscopy, which go back to v9 at least.

The presence of catalog views in the QSYS and QSYS2 schemas, e.g. QSYS2.TABLES, will indicate Db2 for i (AS/400).

Neither Db2 for z/OS nor Db2 for i have the SYSCAT schema views.