• 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, Take Two

    July 20, 2005 Dear Colleagues

    Alert and astute reader Sarah wrote in response to the article, “Case-Insensitive Sorting and Record Selection with Query/400,” that the two sorting options I mentioned are not equivalent. After checking it out, I learned she’s right.

    In the EBCDIC coding sequence, lowercase letters precede uppercase letters, which precede numeric digits. Punctuation and special characters are scattered throughout the sequence. See Chapter 9 of the V5R2 Query manual for more information. Sorting a file of item information by item class yields output of the following nature:

    ITCLS  ITNBR     ITDSC         
     k8    A1120     WHOZIT NOZZLE 
     BU    D881      4" FLAPPITER  
     B1    D880      3" FLAPPITER  
     B1    D882      5" FLAPPITER  
     K4    A1119     WHOZIT        
     K7    A1121     WHOZIT HOSE   
     2A    A101      WIDGET        
     2C    A103      WIDGET MOUNT  
     25    A102      WIDGET HOLDER 
     36    A104      WIDGET BRACKET
    

    Notice that the lowercase k precedes the uppercase B.

    Selecting collating sequence option 2 causes English-language systems that work from CCSID 37 to sort in more or less the same sequence, except that uppercase and lowercase letters are weighted equally.

    ITCLS  ITNBR     ITDSC          
     BU    D881      4" FLAPPITER   
     B1    D880      3" FLAPPITER   
     B1    D882      5" FLAPPITER   
     K4    A1119     WHOZIT         
     K7    A1121     WHOZIT HOSE    
     k8    A1120     WHOZIT NOZZLE  
     2A    A101      WIDGET         
     2C    A103      WIDGET MOUNT   
     25    A102      WIDGET HOLDER  
     36    A104      WIDGET BRACKET
    

    Sarah pointed out that option 5, System sort sequence, places digits ahead of letters. It also equates letters that have diacritical marks with their unembellished counterparts. Here’s the same sort using shared weights under CCSID 37.

    ITCLS  ITNBR     ITDSC          
     25    A102      WIDGET HOLDER  
     2A    A101      WIDGET         
     2C    A103      WIDGET MOUNT   
     36    A104      WIDGET BRACKET 
     B1    D880      3" FLAPPITER   
     B1    D882      5" FLAPPITER   
     BU    D881      4" FLAPPITER   
     K4    A1119     WHOZIT         
     K7    A1121     WHOZIT HOSE    
     k8    A1120     WHOZIT NOZZLE
    

    This sequence is not exactly like ASCII, but it may be close enough for those who need to sort in an ASCII-compatible sequence.

    It may also be worth mentioning that you can define a sort sequence of your own to be used in a query. From the Select collating sequence panel, choose option 3 (Define the sequence). Query/400 presents a screen into which you can key your weights of choice. The initial weights are taken from the national language sequence used on your system.

    –Ted


    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Tags:

    Sponsored by
    WorksRight Software

    Do you need area code information?
    Do you need ZIP Code information?
    Do you need ZIP+4 information?
    Do you need city name information?
    Do you need county information?
    Do you need a nearest dealer locator system?

    We can HELP! We have affordable AS/400 software and data to do all of the above. Whether you need a simple city name retrieval system or a sophisticated CASS postal coding system, we have it for you!

    The ZIP/CITY system is based on 5-digit ZIP Codes. You can retrieve city names, state names, county names, area codes, time zones, latitude, longitude, and more just by knowing the ZIP Code. We supply information on all the latest area code changes. A nearest dealer locator function is also included. ZIP/CITY includes software, data, monthly updates, and unlimited support. The cost is $495 per year.

    PER/ZIP4 is a sophisticated CASS certified postal coding system for assigning ZIP Codes, ZIP+4, carrier route, and delivery point codes. PER/ZIP4 also provides county names and FIPS codes. PER/ZIP4 can be used interactively, in batch, and with callable programs. PER/ZIP4 includes software, data, monthly updates, and unlimited support. The cost is $3,900 for the first year, and $1,950 for renewal.

    Just call us and we’ll arrange for 30 days FREE use of either ZIP/CITY or PER/ZIP4.

    WorksRight Software, Inc.
    Phone: 601-856-8337
    Fax: 601-856-9432
    Email: software@worksright.com
    Website: www.worksright.com

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Quadrant Updates Fax Server Software SafeData Launches Hosting Service for HA and DR

    Leave a Reply Cancel reply

Volume 5, Number 28 -- July 20, 2005
THIS ISSUE
SPONSORED BY:

WorksRight Software
Advanced Systems Concepts
Bug Busters Software Engineering

Table of Contents

  • API Corner: Using the User Profile Exit Programs
  • Case-Insensitive Sorting and Record Selection with Query/400, Take Two
  • Admin Alert: Three Keys to Better ODBC Library List Management

Content archive

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

Recent Posts

  • You Can Now Get IBM Tech Support For VS Code For i
  • Price Cut On Power S1012 Mini Since Power S1112 Ain’t Coming Until 2026
  • IBM i: Pro and Con
  • As I See It: Disruption
  • IBM i PTF Guide, Volume 27, Number 30
  • The Turning Point For Power Systems Is Here, And Now
  • How IBM i Users Can Compete In The Digital Era With Composable Commerce
  • IBM Streamlines Data Migration With New Partition Mirror Tech
  • Profound Logic Adds MCP To IBM i AI Tool
  • IBM i PTF Guide, Volume 27, Number 29

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 © 2025 IT Jungle