select 
s.str_code as storecode,
s.str_org as storeorg,
s.str_desc as des_text
FROM r5stores s, r5userorganization u 
WHERE s.str_org = u.uog_org  
AND u.uog_user = <parameter.r5user>
AND COALESCE(s.str_notused,'-') = '-' 
AND (<parameter.storesec> ='OFF'
      OR EXISTS
      (SELECT 1 FROM r5storesecurity
      WHERE ssc_group = uog_group AND ssc_store = str_code
      AND COALESCE(ssc_issuereturn, '-' ) = '+')
    )

