Both SYSIBM.ROUTINES and SYSCAT.ROUTINES are actually views over the "real" catalog table, SYSIBM.SYSROUTINES. You can grab the SQL definition for each view like so:
WHERE VIEWSCHEMA = 'SYSIBM' AND VIEWNAME = 'ROUTINES';
WHERE VIEWSCHEMA = 'SYSCAT' AND VIEWNAME = 'ROUTINES';
I won't post the results here as I've no idea if that's considered proprietary by IBM (it is technically source from DB2 itself after all). Anyway, if you look through the view source (you'll want to re-format it first with some SQL lint-like tool!) you'll notice several things:
- SYSIBM.ROUTINES excludes functions with type "T" and "R" (i.e. table and row functions, so it only includes scalar functions, aggregates, and procedures). This probably explains a lot of the difference.
- SYSIBM.ROUTINES excludes routines in the schema SYSFUN. This probably explains the rest of the difference as there's 100+ routines in SYSFUN.
- SYSCAT.ROUTINES only excludes routines from the SYSIBMINTERNAL schema (there's only a few of these - not sure if all/some/none show up in SYSIBM.ROUTINES given the restrictions above).
- There's a load of joins in each view but I'm pretty sure they're all 1-to-1 and aren't affecting the cardinality of the result which is dictated by SYSIBM.SYSROUTINES (most of those joins are for pulling in things like the result type or collation details).
- The tables starting with SYS in the SYSIBM schema are the real catalog tables that everything is based upon. Generally I wouldn't bother with these as they're undocumented, and a bit of a pain to work with (however in things like DB2 for z/OS which lacked SYSCAT last time I worked with it, they're the only tables you've got).
- The views not starting with SYS in the SYSIBM schema have a structure awfully similar to the standard INFORMATION_SCHEMA. Something probably uses them as such (maybe some JDBC methods, or the catalog functions in various drivers?) but as they're otherwise undocumented it's difficult to know exactly what they include/exclude without looking at their view definitions (using the trick above).
- The views in the SYSCAT schema are the really useful ones. They're well documented and generally quite easy to work with (sadly they're also DB2 for LUW specific).
In other words, I'd generally treat the SYSCAT results as "gospel" but if you want to understand exactly what they're showing then you need to dive into their source.