== Why is this an issue?

``++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

[source,rpg]
----
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

[source,rpg]
----
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
----

ifdef::env-github,rspecator-view[]

'''
== Implementation Specification
(visible only on this page)

=== Message

Use a SQL view instead


endif::env-github,rspecator-view[]
