• 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
    DRV Tech

    Get More Out of Your IBM i

    With soaring costs, operational data is more critical than ever. IBM shops need faster, easier ways to distribute IBM applications-based data to users more efficiently, no matter where they are.

    The Problem:

    For Users, IBM Data Can Be Difficult to Get To

    IBM Applications generate reports as spooled files, originally designed to be printed. Often those reports are packed together with so much data it makes them difficult to read. Add to that hardcopy is a pain to distribute. User-friendly formats like Excel and PDF are better, offering sorting, searching, and easy portability but getting IBM reports into these formats can be tricky without the right tools.

    The Solution:

    IBM i Reports can easily be converted to easy to read and share formats like Excel and PDF and Delivered by Email

    Converting IBM i, iSeries, and AS400 reports into Excel and PDF is now a lot easier with SpoolFlex software by DRV Tech.  If you or your users are still doing this manually, think how much time is wasted dragging and reformatting to make a report readable. How much time would be saved if they were automatically formatted correctly and delivered to one or multiple recipients.

    SpoolFlex converts spooled files to Excel and PDF, automatically emailing them, and saving copies to network shared folders. SpoolFlex converts complex reports to Excel, removing unwanted headers, splitting large reports out for individual recipients, and delivering to users whether they are at the office or working from home.

    Watch our 2-minute video and see DRV’s powerful SpoolFlex software can solve your file conversion challenges.

    Watch Video

    DRV Tech

    www.drvtech.com

    866.378.3366

    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

  • And Then There Were Two: Big Blue Withdraws IBM i 7.4
  • Crossroads RMC Shows Off New AI Dashboard at inPOWER 2025
  • Guru: When Attention Turns To You – Writing Your Own ATTN Program
  • Rocket Taps IDC To Assess The Benefits Of Full Scope IT Modernization
  • IBM i PTF Guide, Volume 27, Number 38
  • Positive News From The Kyndryl Mainframe Modernization Report
  • NAViGATE, inPower 2025 On Tap for September 2025
  • Guru: WCA4i And Granite – Because You’ve Got Bigger Things To Build
  • As I See It: Digital Coup
  • IBM i PTF Guide, Volume 27, Number 37

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