This command can be issued from an MVS console, a DSN session under TSO, a DB2I panel (DB2 COMMANDS), an IMS or CICS terminal, or a program using the instrumentation facility interface (IFI). You will need to learn about the IFI and how to make IFI calls from your program in order to issue this command.
In a data sharing environment, the output will include information about the data sharing group and each of its members, including the DB2 level. Level is another name for DB2 Version. So, for Version 6, the DB2 level would be listed as 610. This command returns a lot of information, so be sure to review the manual for the format of the output so your CICS program can interpret it.
In a non-data sharing environment, of course, the output will not include any data sharing information; the information will be for the DB2 subsystem to which you are attached.