CL Outfiles are like totally last year, Dude!

  • Home
  • /
  • Blog
  • /
  • CL Outfiles are like totally last year, Dude!

October 17, 2012

CL Outfiles are like totally last year, Dude!

By NickLitten

October 17, 2012


Using the internal cross reference files mean that us lowly IBMi Programmers can access heap of system information just by reading a file… the days of DSPFFD to an outfile then reading the outfile are long gone – we can just read the file field information direct from QADBIFLD instead…

There are eight cross-reference physical files, each containing a different type of information.

  • QADBXREF. This is the big daddy system cross-reference file. It lists the information on every file on the system; where it is, what it looks like, who stroked it last and even, in some cases, what they had for breakfast.
  • QADBFDEP – So this file basically holds the contents of the DSPDBR command — really useful if you looking for lists of logical files and other key related information.
  • QADBIFLD – Every Field in every file on the entire system! Thats right – Simply love this file. In the olden days I would always write little CLP programs to query a file to find the fields in the file, then read through those outfiles to find the field ifnormation but not anymore. Now we just read QADBFDEP and see it all in one big glorious heap – super fast and easy.
  • QADBKFLD Here was have all the information about every key on every file on the box. Whoa I hear you mutter that gives me an idea… thats right… these previous three files give you all the information to right the holy grail of AS400 Utility Programmers – a DSPFLD, DSPKEY and DSPLFINF command 🙂
  • QADBFCST – This is the Referential Constraints Header file… if you dont know what that means then I’m not going to waste keyboard taps in telling you.
  • QADBCCST – read the description above but change the word HEADER for DETAIL and you will know where I’m coming from.
  • QADBPKG – SQL packages information : The Consistency token field (DBPTKN) contains the package’s “signature,” which is similar in concept to export signatures for ILE service programs and level identifiers for files.
  • QADBXRDBD – SQL information about Relational database definitions. Nuff said.

If you want to find out whats in the those files just use good old DSPFD, DSPFFD or RUNQRY *N if your not clever enough to use the PROJEX4i Toolkit. If you are then try out the DSPKEY command to list logicals over any file – this is a good example of using the cross references files.

Remember, these files are read only – so dont try and get clever and update anything….

{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}

Join the IBM i Community for FREE Presentations, Lessons, Hints and Tips