Cognos Analytics

Cognos Analytics

Connect, learn, and share with thousands of IBM Cognos Analytics users! 

 View Only
Expand all | Collapse all

How to get the report paths from all report objects of cognos analytics catalog

  • 1.  How to get the report paths from all report objects of cognos analytics catalog

    Posted Thu January 23, 2025 09:14 AM

    I would like to get the report paths from the report objects of the cognos catalog, I'm trying to use the CMOBJECTS, CMOBJNAMES, CMCLASSES and CMOBJPROPS tables to get this information but I'm still confused on how exactly to do this. The only approach that I have tried was using the xml column found in CMOBJNAMES7 table to extract the stored paths, but I'm in doubt because when I join it with the audit table COGIPF_RUNREPORT it seems that there is not much matches.

    Does anyone knows an alternative approach to do this?



    ------------------------------
    Paulo Paulo Mcmiller Crisostomo De Olivei
    ------------------------------


  • 2.  RE: How to get the report paths from all report objects of cognos analytics catalog

    Posted Thu January 23, 2025 05:14 PM

    If you open Cognos in your browser and then use the browser console to run some javascript you can get a list of all reports, and report paths in a csv with the snippet below. Paul Mendelson has written about using the expressbus api in the forum before. It does a pretty thorough search of all the objects in a folder and works pretty quickly.

    let objectId = 'xxxxxxxxxxxxxxxxxxxxxx'; // ID of content folder you want to search
    __glassAppController.glassContext.services.ajax.ajax({
      type: 'GET',
      url: __glassAppController.glassContext.gateway + 
           `/v1/expressbus/content-manager?searchPath=storeID('${objectId}')//report|storeID('${objectId}')//interactiveReport&properties=id,defaultName,searchPath`
    })
    .then(function(response) {
      
      let csvContent = "ReportName,ObjectId,Search Path,Path URL\n";
    
      response.forEach(item => {
        let reportName  = item.defaultName        || "";
        let objectId    = item.id                || "";
        let searchPath  = item.searchPath        || "";
        let pathUrl     = item?._meta?.links?.path?.url || "";
        
        function csvSafe(str) {
          return `"${String(str).replace(/"/g, '""')}"`;
        }
    
        csvContent += [
          csvSafe(reportName),
          csvSafe(objectId),
          csvSafe(searchPath),
          csvSafe(pathUrl)
        ].join(",") + "\n";
      });
    
      let blob = new Blob([csvContent], { type: 'text/csv;charset=utf-8;' });
    
      let link = document.createElement("a");
      if (link.download !== undefined) {
        let url = URL.createObjectURL(blob);
        link.setAttribute("href", url);
        link.setAttribute("download", "report_export.csv"); // Change the filename if desired
        link.style.visibility = 'hidden';
        document.body.appendChild(link);
        link.click();
        document.body.removeChild(link);
      }
    })
    .catch(function(error) {
      console.error('Error fetching data:', error);
    });
    
    
     
     


    ------------------------------
    Michael Webb
    ------------------------------



  • 3.  RE: How to get the report paths from all report objects of cognos analytics catalog

    Posted Fri January 24, 2025 03:57 AM

    Thanks for the shoutout Michael!

    It's also worth mentioning that the searchpath parameter is xpath formatted. So you could get all reports (that your user has access to) in Cognos with searchPath=//report. searchPath=//account/folder[@name="My Folders"]//report would get all reports inside user My Folders. 

    I use this solution to populate my Object Search tool. 

    The expressbus api supports paginating outputs, which lets me pull it in batches to prevent timeouts.

    https://server/ibmcognos/bi/v1/expressbus/content-manager?searchPath=//report|//interactiveReport&properties=defaultName,parent,ancestors,id,defaultDescription,searchPath,metadataModelPackage,paths,module,owner,parameters,creationTime,modificationTime,defaultPortalAction,executionFormat,retentions,routingServerGroup,type&options={refProps:[{refPropName:%22ancestors%22,properties:[%22defaultName%22,%22id%22,%22name%22,%22searchPath%22,%22type%22]},{refPropName:%22owner%22,properties:[%22defaultName%22,%22id%22,%22name%22,%22searchPath%22,%22type%22]},{refPropName:%22paths%22,properties:[%22defaultName%22,%22type%22]},{refPropName:%22parent%22,properties:[%22defaultName%22,%22id%22,%22name%22,%22searchPath%22,%22type%22]},{refPropName:%22metadataModelPackage%22,properties:[%22defaultName%22,%22id%22,%22searchPath%22,%22type%22]},{refPropName:%22module%22,properties:[%22defaultName%22,%22id%22,%22searchPath%22,%22type%22]}],maxObjects:500,skipObjects:1000}

    (yeah, this is sorta an add, but a man's gotta eat)

    There are a few other parameter options in the expressbus API, but they're not fully documented so a lot of customers are hesitant to use it. Hey Tim! This is why I keep pushing for this API to be included in the published API stack. It's one of the most useful undocumented APIs Cognos has!



    ------------------------------
    Paul Mendelson Product Manager
    Product Manager
    PMsquare
    ------------------------------



  • 4.  RE: How to get the report paths from all report objects of cognos analytics catalog

    Posted Fri January 24, 2025 12:17 PM

    Hi Paul! 
    Great clarification about the xpath and pagination. I will say this api can be a little dangerous without pagination. If you don't paginate and run it on the Team Content folder and you have a large org with thousands of reports and add "specification" on the list of properties and run it for all reports I have basically grinded down our cognos instance to a halt for all our users. I think the recursive lookup is does is meant for pinpoint searches for the UI to display stuff however it isn't throttled at all. I was surprised that it even let me make a request that large without an automatic timeout or maximum request size. 

    I actually used this expressbus api to parse all specifications xmls for all reports in a folder to gather metadata, relationships, data item definitions, chart types, queries, security groups/roles, and more in csv outputs to try to standardize metadata collection for our financial reporting. Since I don't have access to the  SDK or framework manager this has been a pretty fun learning experience and I am making my own admin tools to run as services in Cognos. All thanks to you Paul! I owe all my growth to your early encouragement and direction as I started reverse engineering it all haha. 



    ------------------------------
    Michael Webb
    ------------------------------



  • 5.  RE: How to get the report paths from all report objects of cognos analytics catalog

    Posted Fri February 07, 2025 12:18 PM
    Edited by Paulo McMiller Mon February 10, 2025 08:58 AM

    Thank you so much, Michael and Paul. I really appreciate your help; the JavaScript code worked fine.

    However, if I may, I would like to get back to discussing the approach of obtaining the report paths by querying the CMOBJ[..] tables. I would like to track those reports and merge them with their activity found in the COGIPF tables. Since these tables are constantly updated, it would be more helpful to have that information by querying them. The only problem I'm struggling with is that I am unable to get a reliable match for the report paths from those tables. Do you know of any other table besides CMOBJNAMES7 (which seems to be missing some paths) that has all the report paths? Or do you have any strategy to construct them from there?



    ------------------------------
    Paulo McMiller
    ------------------------------



  • 6.  RE: How to get the report paths from all report objects of cognos analytics catalog

    Posted Mon January 05, 2026 07:43 PM

    Hi @Paul Mendelson
    There are a few other parameter options in the expressbus API, but they're not fully documented so a lot of customers are hesitant to use it.
    Hey Tim! This is why I keep pushing for this API to be included in the published API stack. It's one of the most useful undocumented APIs Cognos has!

    Can you please post any link to this limited ExpressBusAPI documentation?

    Thank you!

    Andrei



    ------------------------------
    Andrei Istomine
    Open to work - anything Cognos
    https://www.linkedin.com/in/andreii/
    ------------------------------



  • 7.  RE: How to get the report paths from all report objects of cognos analytics catalog

    Posted Wed February 12, 2025 04:18 PM

    @Michael Webb - how do you get to the browser console?



    ------------------------------
    brenda grossnickle
    BI Programmer Analyst
    FIS
    ------------------------------



  • 8.  RE: How to get the report paths from all report objects of cognos analytics catalog

    Posted Fri January 23, 2026 09:19 AM

    i think you mean with inspect or from the dashboard



    ------------------------------
    Udrit Dhakal
    ------------------------------



  • 9.  RE: How to get the report paths from all report objects of cognos analytics catalog

    Posted Fri January 23, 2026 09:32 AM

    I don't know what i mean. I have never seen the Cognos browser console and don't know what you can do with it.



    ------------------------------
    brenda grossnickle
    BI Programmer Analyst
    FIS
    ------------------------------



  • 10.  RE: How to get the report paths from all report objects of cognos analytics catalog
    Best Answer

    Posted Wed February 12, 2025 04:15 PM

    I wrote a MS SQL stored procedure. Below is the tsql code to (1) create a database called temp1 (2) create a stored procedure in temp1 to read the cognos content store looking for reports and queries and writing them to a table (3) call the stored procedure passing in the name of the cognos database - exec cm_ListAllReportsAndQueries 'Store32cm_Cognos11' (4) display the temp1 table CM_ReportList. 

    I wrote the stored procedure so that it could be created and run from a database other than the cognos content store. 

    --drop database temp1
    
    create database temp1
    
    go
    
    use  temp1
    
    go
    
    IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[cm_ListAllReportsAndQueries]') AND type in (N'P', N'PC'))
    DROP PROCEDURE [dbo].[cm_ListAllReportsAndQueries]
    GO
    
    CREATE PROCEDURE [dbo].[cm_ListAllReportsAndQueries]
    
    /***************************************************************
    
    cm_ListAllReportsAndQueries creates table cm_reportlist which lists all the
    reports and queries. 
    
    Example
    =======
    
    -- pass in the Cognos CM Store
    exec cm_ListAllReportsAndQueries 'Store32CM_Cognos11' 
    
    QUERIES
    ========
    
    -- select rows from the output table cm_reportList
    select [Directory Path],[Report Name],[Package Name],[Owner Name],[Type],[Modified],[Created],[CMID],[PCMID],[mapdlocaleid], ReportList_Create from cm_reportlist
    
    
    Changes1
    ========
    2/11/2025 - bxg - created sproc               
    
    ****************************************************************/
    
    @pCognosCMDataBase varchar(28)	 
    
    AS  
    
    BEGIN  
    
          SET NOCOUNT ON
    
    	  declare @note varchar(500) = ''
    	  declare @rowcount int = 0
    	  declare @DBName nvarchar(128) = db_name()
    	  declare @SQL nvarchar(max) = ''
    	  declare @SQL2 nvarchar(max) = ''
    
         /* IF @pReportSpecification IS NULL or @pReportSpecification <> 0
             Set @pReportSpecification = 1    */
          IF @pCognosCMDataBase IS NULL or @pCognosCMDataBase = '' or not exists (select top 1 1 from sysdatabases)
             begin
    			Print 'Invalid Cognos CM Database Name: ' + isnull(@pCognosCMDataBase, 'NULL')
    		 end
         
    		IF OBJECT_ID('[dbo].[CM_ReportList]') IS NOT NULL 
    			DROP TABLE [dbo].[CM_ReportList] 
    
    		CREATE TABLE [dbo].[CM_ReportList] ( 
    			[Directory Path]	VARCHAR(512)      NULL,
    			[Report Name]		NVARCHAR(256)     NULL,
    			[Package Name]		NVARCHAR(256)     NULL,
    			[Owner Name]		NVARCHAR(256)	  NULL,
    			[Type]				VARCHAR(128)	  NULL,
    			[Modified]			DATETIME          NULL,
    			[Created]			DATETIME          NULL,
    			[CMID]				INT               NULL,
    			[PCMID]				INT               NULL,
    			[mapdlocaleid]		SMALLINT          NULL,
    			[ReportList_Create]	DATETIME		  NULL) 
    
    	 set @SQL = N'
    	  use  ' + @pCognosCMDataBase + N'
    
    	 /** query on the Cognos Content Store to find reports and queries (10 and 37) **/
          ; with base_query as
          (
    		  select classid, cmobjects.cmid, cmobjects.pcmid, cmobjnames.name as reportname, cmobjects.disabled, cmobjnames.mapdlocaleid,
    			 cmobjects.CREATED, cmobjects.modified
    			  from cmobjects , cmobjnames
    			  where cmobjects.cmid = cmobjnames.cmid and (cmobjects.disabled is null or cmobjects.disabled <> 1)
    			  and classid in (10, 37) 
    			  and cmobjnames.mapdlocaleid in  (24,96, 92)
    		  union
    		  select classid, cmobjects.cmid as cmid, cmobjects.pcmid, cmobjnames.name as reportname, cmobjects.disabled, cmobjnames.mapdlocaleid,
    			 cmobjects.CREATED, cmobjects.modified
    			  from cmobjects , cmobjnames
    			  where cmobjects.cmid = cmobjnames.cmid and (cmobjects.disabled is null or cmobjects.disabled <> 1)
    			  and  cmobjects.cmid in (select distinct cmobjects.pcmid
    			  from cmobjects)
    			   and cmobjnames.mapdlocaleid in (24,96,92)      
          ),
          
         /** recursive query through the folders to build the report and query path **/
          ctebuildpath as
          (
    		  select base_query.cmid,
    			  base_query.pcmid,
    			  base_query.reportname,
    			  base_query.created,     
    			  base_query.modified,    
    			  base_query.[disabled],
    			  base_query.mapdlocaleid,
    			  1 as Hlevel,classid,
    			  cast(base_query.reportname as varchar(500))as directory_path
    			  from base_query where reportname = ''Team Content'' or reportname = ''My Folders'' 
    		  union all
    		  select recur.cmid,
    			  recur.pcmid,
    			  recur.reportname,
    			  recur.created,    
    			  recur.modified,         
    			  recur.[disabled],
    			  recur.mapdlocaleid,
    			  cte.Hlevel+1 as Hlevel,recur.classid,
    			  cast(cte.directory_path + ''>'' +  recur.reportname as varchar(500))as directory_path
    			  from base_query as recur,
    			  ctebuildpath as cte
    			  where cte.cmid = recur.pcmid
          ),    
    
    	  /** charindex('']/package[@name='', cast(spec as  varchar(max)))+17 as startposition,
    		  charindex('']/model[@name='', cast(spec as  varchar(max)))-18-charindex('']/package[@name='', cast(spec as  varchar(max))) as endposition
    	  **/
          report_spec as 
          (
    		  select cast(spec as  varchar(max)) as spec, c.cmid		  
    		  from cmobjprops7 c inner join ctebuildpath b
    				on c.cmid = b.cmid
    		  where spec is not null 
          ),
    
    	  /** get the package name **/
    	  package as
    		 (
    		 SELECT cmrefnoord1.cmid AS pid,
    		 cmobjnames.name AS package_name
    		 FROM cmrefnoord1
    		 INNER JOIN cmobjects
    		 ON cmrefnoord1.refcmid = cmobjects.cmid
    		 INNER JOIN cmobjnames
    		 ON cmobjects.cmid = cmobjnames.cmid
    		 WHERE cmrefnoord1.propid = 31
    		 AND cmobjnames.ISDEFAULT=1
    		 ), 
    
        /** query to find the Owner of the reports and queries **/
        owner_name as 
        (
    		select a.name, b.cmid
    		  from cmobjprops33 a,  cmobjnames b, cmrefnoord2 c, cmobjects d, cmclasses e, ctebuildpath cte
    		  where b.cmid = c.cmid
    		  and a.cmid = c.refcmid
    		  and b.cmid = d.cmid
    		  and d.classid = e.classid
    		  and (e.name = ''report'' or e.NAME = ''query'')
    		  and cte.CMID = b.cmid
          ),
    
    	  /** get rid of duplicates **/
    	  get_distinct as
    	  (
     		SELECT distinct directory_path as [Directory Path], reportname as [Report Name], package.package_name as [Package Name],
    					ISNULL(Owner_name.name, ''Unknown'') as ''Owner Name'', Case classid When 10 Then ''Report'' Else ''Query'' End as Type,  
    					Modified, Created,
    					cte.cmid as CMID,  cte.pcmid as PCMID, mapdlocaleid 
    				FROM ctebuildpath cte inner join report_spec rep
    							on cte.cmid = rep.cmid 
    							full outer join owner_name 
    							on cte.CMID = owner_name.cmid
    							left join package
    							on package.pid = cte.cmid
    				WHERE cte.classid in (10, 37)
    	 ) '
    
    	-- sql literal cannot be more than 4000 characters. so splitting the dynamic sql into two parts
    	Set @SQL2 = '/**  sort My Folders first, then within My Folder sort by Owner Name. WIthin the second group (Public Folders and ??) sort by Directory Path **/
    		Insert into ' + @dbname	 + N'..CM_ReportList ([Directory Path],[Report Name],[Package Name],[Owner Name],[Type],[Modified],[Created],[CMID],[PCMID],[mapdlocaleid], ReportList_Create)
    			Select [Directory Path],[Report Name],[Package Name],[Owner Name],[Type],[Modified],[Created],[CMID],[PCMID],[mapdlocaleid], getdate()
    				from get_distinct
    				ORDER by 
    					CASE WHEN LEFT([directory path], 11)  = ''My Folders>'' THen 0 ELSE 1 END,
    					CASE WHEN LEFT([directory path], 11)  = ''My Folders>'' THen [Owner Name] ELSE [Directory Path] END,
    					[directory path]  '
    					
    					 
    	set @sql = @sql + @sql2
    
    	--exec util_longprint @sql 
    
    	exec sp_executesql @SQL    
    
    	set @rowcount = @@rowcount
    		
    	Print 'CM Create ReportList created with ' + cast(@RowCount as varchar(12)) + ' rows.'
    		           
    END
    
    GO
    
    exec cm_ListAllReportsAndQueries 'Store32cm_Cognos11'
    
    select * from CM_ReportList
    
    
    



    ------------------------------
    brenda grossnickle
    BI Programmer Analyst
    FIS
    ------------------------------



  • 11.  RE: How to get the report paths from all report objects of cognos analytics catalog

    Posted Thu January 08, 2026 08:36 AM

    Hi Brenda,

    Thanks for sharing this! Were you able to figure out how to capture data module names? The Package Name logic doesn't appear to work as it's just integer values when the source is a data module.

    I'll keep investigating too.

    Thanks again. This is fantastic.



    ------------------------------
    Jeremy Aude
    ------------------------------



  • 12.  RE: How to get the report paths from all report objects of cognos analytics catalog

    Posted Thu January 08, 2026 11:02 AM

    I found the change required. It's in the query for package name and I just needed to add propid 58 in the where clause for data modules.

    /** get the package name **/
    package as (
    SELECT
    cmrefnoord1.cmid AS pid,
    cmobjnames.name AS package_name
    FROM
    cmrefnoord1
    INNER JOIN cmobjects ON cmrefnoord1.refcmid = cmobjects.cmid
    INNER JOIN cmobjnames ON cmobjects.cmid = cmobjnames.cmid
    WHERE
    1 = 1
    and cmrefnoord1.propid in ( 31, 58 ) -- 31 is package and 58 is data module
    AND cmobjnames.ISDEFAULT = 1


    ------------------------------
    Jeremy Aude
    ------------------------------



  • 13.  RE: How to get the report paths from all report objects of cognos analytics catalog

    Posted Thu January 08, 2026 11:44 AM
    Edited by brenda grossnickle Thu January 08, 2026 11:47 AM

    I was just getting ready to reply. Yes, 58 is modules.

     

    Attached is an xml doc that is useful.

     

     



  • 14.  RE: How to get the report paths from all report objects of cognos analytics catalog

    Posted Thu January 08, 2026 11:50 AM
    Edited by brenda grossnickle Thu January 08, 2026 11:50 AM
      |   view attached

    Useful File for looking inside the CM database table/columns



  • 15.  RE: How to get the report paths from all report objects of cognos analytics catalog

    Posted Fri January 09, 2026 08:42 AM

    This is so helpful Brenda. Thank you! I don't have the technical expertise to try using the SDK and we're too small of a shop to purchase third-party software.

    I'm currently trying to evaluate our environment to identify overlaps in model and reporting. Looking for opportunities to consolidate and enhance. This makes it so much easier to see what is and isn't being used (when comparing with audit data) and also grab the related report XML instead of manually opening each report...which is even more painful when sifting through users content. 

    Thank you again. I feel lucky I found this thread because searching through the community for posts isn't always easy!



    ------------------------------
    Jeremy Aude
    ------------------------------



  • 16.  RE: How to get the report paths from all report objects of cognos analytics catalog

    Posted Fri January 09, 2026 08:58 AM

    MotioPI has a free download that is very useful. I think that you will find it useful. We use it for regression testing prior to release to verify that are updates did not break any reports. It has much more than that but since we are a large shop with many cognos instances and servers we don't use it as much. 



    ------------------------------
    brenda grossnickle
    BI Programmer Analyst
    FIS
    ------------------------------



  • 17.  RE: How to get the report paths from all report objects of cognos analytics catalog

    Posted Mon January 12, 2026 12:25 PM

    I just downloaded this tool and it is very useful! The validation of reports is fantastic!

    I was hoping it would allow me to find report email recipients, which is doe well, but it doesn't seem to be able to search in job steps for this info. 



    ------------------------------
    Jeremy Aude
    ------------------------------



  • 18.  RE: How to get the report paths from all report objects of cognos analytics catalog

    Posted Mon January 12, 2026 01:30 PM

    Jeremy, are you saying that the free version of MotioPI shows the email recipients for Report Schedules but no Job Schedules? Wondering if it will show email recipients that were selected from Active Directory and not hand typed.



    ------------------------------
    brenda grossnickle
    BI Programmer Analyst
    FIS
    ------------------------------



  • 19.  RE: How to get the report paths from all report objects of cognos analytics catalog

    Posted Tue January 13, 2026 09:27 AM

    Hi Brenda, that's correct (unless I am doing something wrong). Even without filters, the product doesn't show job step information - just the job level. 



    ------------------------------
    Jeremy Aude
    ------------------------------



  • 20.  RE: How to get the report paths from all report objects of cognos analytics catalog

    Posted Thu January 22, 2026 11:16 AM

    Hi Jeremy,

    I know you mention your a small shop and don't have much budget but something to think about is Security 4X Reporting. It is economical and includes reports for all content in Cognos including Job Steps and Email recipients whether SMTP addresses (typed in) or Directory Service user references such as Active Directory.  Security 4X Reporting can be purchased separately and pricing is based on the number of users and also discounted by volume. So it could be, and should be, quite economic for any size shop, small or big. 

    Also S4X Reporting does not use the SDK so you have many performance benefits. With the several reports you get it is easy to tailor report views so that you can reliably and continuously serve different user groups with up-to-date information about their Cognos Analytics Content. At a glance I am not seeing anything listed above that wouldn't be covered in terms of objects and properties but feel free to ask me something specific and I'd be happy to check.  

    Best Paul

    info@attaininsight.com
    paul.hulford@attaininsight.com



    ------------------------------
    Paul Hulford
    ------------------------------



  • 21.  RE: How to get the report paths from all report objects of cognos analytics catalog

    Posted Tue January 06, 2026 03:37 AM

    Hello @Paulo McMiller,

    might want to use SDK to extract the information. Here is a repo that contains various helpers to extract and manipulate data via SDK: https://github.com/AMVARA-CONSULTING/cocoma/tree/master

    CoCoMa has an option: --dumpSecurityAndAccounts

    This extracts any information using the following function:

    	public void dumpSecuriyAndAccounts() {
    
    		// get all accounts and dump the data
    		ContentManagerService_PortType cms = c8Access.getCmService();
    
    		String[] queries = { "//account", "//role", "//group", "//content", "//package", "//folder" };
    
    		// initial values
    		SearchPathMultipleObject spmo = null;
    		PropEnum[] props = new PropEnum[] { PropEnum.userName, PropEnum.name, PropEnum.searchPath, PropEnum.defaultName,
    				PropEnum.userCapabilityPolicies };
    		Sort[] sort = new Sort[] {};
    
    		// loop over each query and print out information
    		for (String query : queries) {
    			log.debug("==============================");
    			log.debug("Dumping information in " + query);
    			log.debug("==============================");
    
    			spmo = new SearchPathMultipleObject(query);
    
    			try {
    				BaseClass[] results = cms.query(spmo, props, sort, setQORefPropsForAccounts());
    
    				if (results.length < 1) {
    					log.error("Query for " + query + " did not return any results");
    				} else {
    					for (BaseClass bc : results) {
    						logBaseObjectData(bc);
    					}
    				}
    
    			} catch (RemoteException e) {
    				log.error("Error querying " + query + " data. " + e.getMessage());
    			}
    		}
    	}

    Don´t be mislead by the c8.Access() function call. It works with C11 + C12 alike.

    Hope this helps.



    ------------------------------
    Ralf Roeber
    https://linkedin.com/in/ralf-roeber/
    ------------------------------



  • 22.  RE: How to get the report paths from all report objects of cognos analytics catalog

    Posted Mon January 12, 2026 04:19 PM
    Edited by Jeam Coelho Mon January 12, 2026 04:20 PM

    Hi, this query works for Db2 using Recursive CTE

    WITH FOLDER (LEVEL, CMID, NAME) AS (
    
    select 1 as level, 2,  cast('Team Content' as varchar(10000))
    from sysibm.sysdummy1
    
    UNION ALL
    
    select parent.LEVEL + 1 , child.cmid,  parent.NAME || ' / ' || opfolder.name
    FROM FOLDER parent , CMOBJECTS child , CMOBJNAMES opfolder , CMCLASSES c 
    WHERE parent.CMID= child.PCMID
    AND child.CMID = opfolder.CMID AND opfolder.ISDEFAULT = 1
    AND c.CLASSID = child.CLASSID
    AND parent.LEVEL < 20  AND c.NAME IN ('folder' ) 
    )
    
    SELECT
    PACKAGE_NAME,
    OBJECT_TYPE,
    OWNER,
    folder,
    STOREID,
    OBJECT_NAME
    
    FROM (
    
    SELECT
    pack.NAME AS PACKAGE_NAME,
    UPPER(c.NAME) AS OBJECT_TYPE,
    COALESCE(props33.USERID, props33.NAME) OWNER,
    opf.NAME as folder,
    'i' || substring(UPPER(cs.STOREID) , 2 , length(cs.STOREID) -1 ) STOREID,
    obj.name OBJECT_NAME
    FROM CMOBJECTS o
    INNER JOIN CMCLASSES c on c.CLASSID = o.CLASSID
    INNER JOIN CMOBJNAMES obj ON obj.CMID = o.CMID AND obj.ISDEFAULT = 1
    INNER JOIN CMSTOREIDS cs ON o.CMID = cs.CMID
    INNER JOIN FOLDER opf ON o.PCMID = opf.CMID
    LEFT JOIN CMREFNOORD1 ref ON o.CMID = ref.CMID
    LEFT JOIN CMOBJECTS op ON ref.REFCMID = op.CMID
    LEFT JOIN CMCLASSES cp ON cp.CLASSID = op.CLASSID
    LEFT JOIN CMOBJNAMES pack ON pack.CMID = op.CMID AND pack.ISDEFAULT = 1
    LEFT JOIN CMREFNOORD2 REF2 ON o.CMID = REF2.CMID
    LEFT JOIN CMOBJPROPS33 props33 ON REF2.REFCMID = props33.CMID 
    WHERE c.NAME IN ('dataSet2' , 'report' ) 
    AND cp.NAME in ('package', 'module' , '_deletedObject' , null) 
    
    UNION
    
    SELECT
    pack.NAME AS PACKAGE_NAME,
    UPPER(c.NAME) AS OBJECT_TYPE,
    COALESCE(props33.USERID, props33.NAME) OWNER,
    opf.NAME as folder,
    'i' || substring(UPPER(cs.STOREID) , 2 , length(cs.STOREID) -1 ) STOREID,
    obj.name OBJECT_NAME
    FROM CMOBJECTS o
    INNER JOIN CMCLASSES c on c.CLASSID = o.CLASSID
    INNER JOIN CMOBJNAMES obj ON obj.CMID = o.CMID AND obj.ISDEFAULT = 1
    INNER JOIN CMSTOREIDS cs ON o.CMID = cs.CMID
    INNER JOIN FOLDER opf ON o.PCMID = opf.CMID
    LEFT JOIN CMREFNOORD1 ref ON o.CMID = ref.CMID
    LEFT JOIN CMOBJECTS op ON ref.REFCMID = op.CMID
    LEFT JOIN CMCLASSES cp ON cp.CLASSID = op.CLASSID
    LEFT JOIN CMOBJNAMES pack ON pack.CMID = op.CMID AND pack.ISDEFAULT = 1
    LEFT JOIN CMREFNOORD2 REF2 ON o.CMID = REF2.CMID
    LEFT JOIN CMOBJPROPS33 props33 ON REF2.REFCMID = props33.CMID 
    WHERE c.NAME IN ('exploration' ,  'module' ,  'reportView' , 'uploadedFile' , 'jupyterNotebook' ) 
    
     ) T
    
    

    ------------------------------
    Jeam Coelho
    Cognos Solution Architect

    IBM Champion

    LinkedIn: https://www.linkedin.com/in/jeamcoelho/
    ------------------------------