The only way which is "officially" supported by Informatica is the so-called Operations API (formerly known as the Load Manager API, in short LMAPI). It's available in C and in Java. This API offers functions with which you can retrieve those numbers as displayed in the Workflow Monitor (which, in fact, is an application of the Operations API).
Cannot directly get within mapping?
Since I want to get the record count within the Informatica
You can easily count the records you have read via an Aggregator, and you can do the same with the records you want to write. But:
- you cannot count records which have not been read at all,
- you cannot make sure that a target DB accepted all records you're trying to write.
So these counts cannot be 100% accurate.
Even worse, there are DB drivers which do accept data even though they cannot save them "physically" in the target DB, and they don't give any feedback to the PowerCenter session (so the count of "failed target records" will be inaccurate). There's nothing you can do in PowerCenter to completely avoid such errors.
From this point of view safety by counting within a mapping doesn't exist.