Has file unique key?
Last Post 19 Mar 2013 04:07 AM by Jan. 5 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
Jan
Advanced Member
Advanced Member
Posts:703

--
18 Mar 2013 05:36 AM

Hi all of you

I want to be able to retreive a files property 'Keys must be unique: N=No, Y=Yes'.
It is possible to find that out using Output file for DSPFD TYPE(*ACCPTH), then field APUNIQ shows just that.

But I suspect there must be a file in QSYS containing that field too.
Can somebody point me to that file/field?

Info about the key fields of my item master file can be retreived like this:

select               dbkfld                    dbkfld /* Field    */  
     ,               dbkord                    dbkord /* Order    */  
     , cast(         dbifln      as dec(7, 0)) dbifln /* Length   */  
     ,               dbiitp                    dbiitp /* Type     */  
     , cast(coalesce(dbinsc, 99) as dec(2, 0)) dbinsc /* Decimals */  
     , coalesce(trim(dbitxt), trim(dbihdg))    dbitxt /* Text     */  
  from      qsys/qadbkfld                                             
       join qsys/qadbifld on dbilib = dbklib                          
                         and dbifil = dbkfil                          
                         and dbifmt = dbkfmt                          
                         and dbifld = dbkfld                          
 where dbklib = 'MYDTALIB'                                           
   and dbkfil = 'ITEMMASTER'                                            

 

 

DBKFLD      DBKORD     DBIFLN   DBIITP  DBINSC  DBITXT                   
COMPIM        A             2     A       99    Company code
ITEMIM        A            20     A       99    Item code

Kind regards
Jan

Jack Callahan
Basic Member
Basic Member
Posts:303

--
18 Mar 2013 07:58 AM

I've retrieved the information for a given file using the QDBRTVFD api.

DB2i catalog view QSYS2.SYSCST might satisfy your needs.

B.Hauser
Veteran Member
Veteran Member
Posts:2014

--
18 Mar 2013 08:28 AM

I'd look at the catalog views:

SYSPARTITIONSTAT, SYSINDEXSTAT, SYSTABLEINDEXSTAT and SYSTABLESTAT

Birgitta

Jan
Advanced Member
Advanced Member
Posts:703

--
18 Mar 2013 11:11 AM

Thanks Birgitta and Jack

I could not find the Unique-indication in the proposed files.

Regards
Jan

Jack Callahan
Basic Member
Basic Member
Posts:303

--
18 Mar 2013 02:23 PM

Might try QSYS.QADBXREF for column DBXUNQ

I would be hesitant to use what I consider an IBM internal data structure over using the QDBRTVFD api. YMMV.

 

Jan
Advanced Member
Advanced Member
Posts:703

--
19 Mar 2013 04:07 AM
Thanks very much Jack.
You are not authorized to post a reply.

Acceptable Use Policy