``++SELECT++`` and ``++OMIT++`` allow you to choose records from a logical file based on the values of specific fields. SQL views allow you to make the same distinctions, but their use is more efficient, and easier to read and understand. Therefore views are preferred over ``++SELECT++`` and ``++OMIT++`` statements.


== Noncompliant Code Example

----
Index: SKCOU03

 *************** Beginning of data *************************************
      A          R SKCOU                     TEXT('Coupon Rate Details')
      A                                      PFILE(SKCOUP)
      A          K COUASS
      A          K COUEFF                    DESCEND
      A          S COUSTS                    COMP(EQ 'L')
      A          S COUSTS                    COMP(EQ 'X')

****************** End of data ***************************************
----


== Compliant Solution

----
CREATE VIEW SKCOU03 AS
SELECT A.COUFLD1, A.COUASS, A.COUEFF, A.COUSTS, A.COUFLD4
FROM SKCOUP A
where
A.COUSTS = ‘L’ OR A.COUSTS=’X’
Order by A.COUASS, A.COUEFF desc
----

