× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



RPG ALTSEQ (alternate collating sequence) allows you to control how
character data is sorted and compared.  For instance different cultures
prefer that certain characters sort/compare in different ways; an
example of this would be the Latin ligature AE (one character) where
many European nationalities prefer that AE sort/compare between 'a' and
'b' while Norwegian users may prefer AE sorts/compares after 'z'.   As
another example, a user may prefer that 'a' sort/compare equal with 'A'
(and not as before/notequal to 'A').  The attached ILE RPG program
shows simplistically how this can be controlled via the H spec ALTSEQ
keyword and CRTRPGPGM parameters.  This is a SIMPLE example, and in
real life one would probably use *JOBRUN values, but I didn't want to
introduce another level of indirection (though one very handy if you
want one *PGM to support many languages in a culturally correct manner)
for this example.

Please note that the default behavior is Hex which means no one is
necessarily "culturally happy", but the program runs the fastest.
Introducing any collation sequence (other than Hex) will cause more
work (sometimes substantially more work) "under the covers" (though as
the sample shows, with the same source code).

Bruce


     H* To test Hex collation comment out the following H spec
     H ALTSEQ(*EXT)
     H* To test Common Latin-1 collation leave the previous H spec and
     H* compile with CRTBNDRPG XXX SRTSEQ(*LANGIDUNQ) LANGID(ENU)
     H*
     H* To test Common Latin-1 collation leave the previous H spec and
     H* compile with CRTBNDRPG XXX SRTSEQ(*LANGIDUNQ) LANGID(NON)
     H*
     H* To test Common Latin-1 shared collation use previous H spec and
     H* compile with CRTBNDRPG XXX SRTSEQ(*LANGIDSHR) LANGID(ENU)
     D*
     D* Define some constants to check where codepoints collate
     DLatin_AE         s              1    inz(x'9E')
     DLatin_a          s              1    inz('a')
     DLatin_b          s              1    inz('b')
     DLatin_r          s              1    inz('r')
     DLatin_s          s              1    inz('s')
     DLatin_z          s              1    inz('z')
     C* check if between 'a' and 'b'; if so it's Common Latin-1 sequence
     C     Latin_AE      ifgt      Latin_a
     C     Latin_AE      andlt     Latin_b
     C     'Common'      dsply
     C                   endif
     C* check if between 'r' and 's'; if so it's CCSID 37 Hex sequence
     C     Latin_AE      ifgt      Latin_r
     C     Latin_AE      andlt     Latin_s
     C     'Hex   '      dsply
     C                   endif
     C* check if after 'z'; if so it's Norwegian Bokmal sequence
     C     Latin_AE      ifgt      Latin_z
     C     'Bokmal'      dsply
     C                   endif
     C* check if equal 'a'; if so it's Shared weight
     C     Latin_AE      ifeq      Latin_a
     C     'Shared'      dsply
     C                   endif
     C                   move      '1'           *inlr
     C                   return



>
>What does it means of the keyword ALTSEQ and the concept
>about the Collating Sequence?
>
>Thanks.
>

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* This is the RPG/400 Discussion Mailing List!  To submit a new         *
* message, send your mail to "RPG400-L@midrange.com".  To unsubscribe   *
* from this list send email to MAJORDOMO@midrange.com and specify       *
* 'unsubscribe RPG400-L' in the body of your message.  Questions should *
* be directed to the list owner / operator: david@midrange.com          *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.