Using a collating sequence table to order data

A collating (sort) sequence table has 256 entries arranged in 8 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.

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:

Copy of QSYSTRNTBL:

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)
SRCMBR(tbldemo) CVTTOUCS(*NO)

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

WRKTBL TBL(*ALL)


This was first published in September 2005

Dig deeper on iSeries programming commands

0 comments

Oldest 

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:

-ADS BY GOOGLE

SearchEnterpriseLinux

SearchDataCenter

Close