Seeing which index or logical file is being used by a SQL statement

I was asked if it was possible to see which DDS file or SQL index was used by a SQL statement?

Fortunately it is easy to see. But before I show how to do it, let me set up my “test data”.

I have my physical file, TESTFILE, which has no key:

A R TESTFILER
A FLD001 6P 0
A FLD002 10A
A FLD003 L

I built two logical files built over this physical file. TESTFILEL0 has the field FLD001 as its only key:

A R TESTFILER PFILE(TESTFILE)
A K FLD001

And TESTFILEL1, which has the key field FLD003:

Read more »

Verified by MonsterInsights