Search code examples
ibm-midrange

How to add logical operator on logical source file


I have this logical source file:

A          S VALIDFLAG                 CMP(EQ '1') 
A          S ITEMPFX                   CMP(EQ 'PF')

But it seems that it works as an OR when I use the logical file using SQL. Where can I place the AND?

I checked this link but it doesn't have a sample for the AND. https://www.ibm.com/docs/en/i/7.1?topic=80-comp-comparison-keyword-physical-logical-files

I tried this but it is having an error on the AND.

A          S VALIDFLAG                 CMP(EQ '1') AND
A          S ITEMPFX                   CMP(EQ 'PF')

Solution

  • Combining conditions with OR:

     A          S VALIDFLAG                 CMP(EQ '1') 
     A          S ITEMPFX                   CMP(EQ 'PF')
    

    Combining conditions with AND:

     A          S VALIDFLAG                 CMP(EQ '1') 
     A            ITEMPFX                   CMP(EQ 'PF')