• The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
Menu
  • The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
  • Case-Insensitive Sorting and Record Selection with Query/400

    June 22, 2005 Hey, Ted

    Thanks for explaining how to ignore case when sorting and selecting records with SQL. Can you tell me how to do the same with Query/400?

    –Ron

    Sure. First, here’s a database file that we can query.

    LASTNAME    FIRSTNAME 
    smith       billy     
    Smith       Amos      
    SMITH       CHARLEY   
    smith       DICK      
    Smith       ELMO      
    SMITH       dan       
    JONES       Andy
    

    The normal sort places lowercase letters before uppercase ones, like this:

    LASTNAME    FIRSTNAME 
    smith       billy     
    smith       DICK      
    JONES       Andy      
    Smith       Amos      
    Smith       ELMO      
    SMITH       dan       
    SMITH       CHARLEY
    

    From the Define the Query panel, place a 1 (one) beside the Select collating sequence option and press Enter. If your system has a collating sequence option of 2 (Query for iSeries English), you can use this option. If not, select option 5 (System sort sequence). On the following panel, Select System Sort Sequence, select Sort sequence 3 (Shared) and a Language id of *JOBRUN. Our example data sorts alphabetically.

    LASTNAME    FIRSTNAME 
    JONES       Andy      
    Smith       Amos      
    smith       billy     
    SMITH       CHARLEY   
    SMITH       dan       
    smith       DICK      
    Smith       ELMO
    

    You will also be able to select data regardless of case. Here’s an example from the Select Records panel.

    Field             Test   Value 
    FIRSTNAME         LIKE   'D%'
    

    All records in the resulting dataset have first names that begin with either capital or lowercase D.

    LASTNAME    FIRSTNAME
    SMITH       dan      
    smith       DICK
    

    The system would have given me the same results if I had coded a lowercase d in the Value expression.

    Field             Test   Value 
    FIRSTNAME         LIKE   'd%'
    

    –Ted

    RELATED STORY

    Case-Insensitive Sorting and Record Selection in SQL/400


    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Tags:

    Sponsored by
    Trinity Guard

    Register to Attend Webinar: IBM i Network Security

    From exit point traffic to lesser visible socket connections, applications connect to IBM i in various forms and pose security risks.

    Join this 1-hour session to learn the how-to’s of securing network connections to your IBM i and safeguard against costly security breaches.

    Thursday, March 25
    12 Noon CT  / 10AM PT  /  1PM ET

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    LaserVault Boosts Compliance Efforts with New Audit Log Original Looks for Performance Problems with New TestLOAD Tool

    Leave a Reply Cancel reply

Volume 5, Number 25 -- June 22, 2005
THIS ISSUE
SPONSORED BY:

Advanced Systems Concepts
WorksRight Software
Patrick Townsend & Associates

Table of Contents

  • Execute SQL Statements on DB2 UDB for Windows from the iSeries
  • Case-Insensitive Sorting and Record Selection with Query/400
  • Turning Off ODBC Journaling Is Not a Good Idea

Content archive

  • The Four Hundred
  • Four Hundred Stuff
  • Four Hundred Guru

Recent Posts

  • Why Open Source Is Critical for Digital Transformation
  • mrc Refreshes IBM i Low-Code Dev Tool
  • Unit Testing Automation Hits Shift Left Instead of Ctrl-Alt-Delete Cash
  • Four Hundred Monitor, March 3
  • IBM i PTF Guide, Volume 23, Number 9
  • Doing The Texas Two Step From Power9 To Power10
  • PHP’s Legacy Problem
  • Guru: For IBM i Newcomers, An Access Client Solutions Primer
  • IBM i 7.1 Extended Out To 2024 And Up To The IBM Cloud
  • Some Practical Advice On That HMC-Power9 Impedance Mismatch

Subscribe

To get news from IT Jungle sent to your inbox every week, subscribe to our newsletter.

Pages

  • About Us
  • Contact
  • Contributors
  • Four Hundred Monitor
  • IBM i PTF Guide
  • Media Kit
  • Subscribe

Search

Copyright © 2021 IT Jungle

loading Cancel
Post was not sent - check your email addresses!
Email check failed, please try again
Sorry, your blog cannot share posts by email.