Is there a db2 function/procedure/variable that can be used to determine what platform a data source origins from? sysibm.sysdummy1 exists, so I assume that this is Db2, but some of the SQL does not look right according to LUW syntax. Is there an easy way to figure out via SQL what platform a data source origins from?
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
Another indicator of Db2 for LUW is the presence of some Oracle-compatible views since v.9.7, e.g.
A good indicator of Db2 for z/OS would be the presence of mainframe-specific catalog tables, e.g.
sysibm.syscopy, which go back to v9 at least.
The presence of catalog views in the
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.