Using a collating sequence table to order data

A collating (sort) sequence table has 256 entries arranged in eight records, each with 32 2 byte hex values. The logical position in the table represents the values hex values 00-FF. The hex value entered in the logical position determines the collating sequence of the logical value.

An alternate collating sequence table can be easily created that would place numeric information ahead of alpha. The numbers 0-9 (F0-F9) occupy entries 240-249 of the table. To cause 0-9 to sort before the upper and lower case letters of the alphabet, change the values in entries 240-249 to something less than hex value 81 (lower case (a)). Replacement with Hex values 00-09 would cause 0-9 to collate to the top of the collating sequence.

The screen print below shows the normal collating sequence. The logical hexadecimal character implied by position in the table and the actual entry are equal. Any change to the actual entry affects the collating sequence of the logical entry.

System Default Collating Sequence:


The logical file DDS below uses the IBM supplied QSYSTRNTBL to equally collate mixed case alphabetic data. Fields AFNAM, ALAST and AFIRST are mixed case. Use the keyword ALTSEQ to replace the default table.

Table commands: RTVTBLSRC TBL( QSYSTRNTBL) SRCFILE(jgreene/qsource)

CRTTBL TBL(jgreene/tbldemo) SRCFILE(jgreene/qsource)


This was first published in September 2005

There are Comments. Add yours.

TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.