MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

ALTSEQ in sort

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
YSMVS
Beginner


Joined: 19 May 2004
Posts: 51
Topics: 25
Location: My House

PostPosted: Sun Dec 12, 2004 2:06 am    Post subject: ALTSEQ in sort Reply with quote

Hi,

I am not very clear on usage of ALTSEQ.
I want 'M' to come after 'Z' in the collating sequence.
How to code the command ?
How to conver the character to HEX ?

Bear me if I am trivial in my question.

Thanks,
YSMVS
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Sun Dec 12, 2004 11:23 am    Post subject: Reply with quote

Quote:
I want 'M' to come after 'Z' in the collating sequence.
How to code the command ?


To sort 'M' after 'Z', you can use the following DFSORT statements:

Code:

  ALTSEQ CODE=(D4EA)
  SORT FIELDS=(p,m,AQ,A)


p is the starting position of the key and m is the length of the key (e.g. 21,4,AQ,A).

M is X'D4' and Z is X'E9'. D4EA in the ALTSEQ statement tells DFSORT to set up the alternate collating sequence table (ALTSEQ table) with M after Z.

The AQ format in the SORT statement tells DFSORT to SORT that key using the alternate collating sequence table.

Quote:
How to conver the character to HEX ?


If you do a Google search on "EBCDIC", you'll find many tables that show you the hex equivalent for each EBCDIC character. Here's the URL of the first one Google found when I did the search:

http://www.natural-innovations.com/computing/asciiebcdic.html

Of course, you could use DFSORT's p,m,HEX parameter to convert EBCDIC characters to hex characters, but looking at a table is probably easier when you just want the hex codes for ALTSEQ.
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
YSMVS
Beginner


Joined: 19 May 2004
Posts: 51
Topics: 25
Location: My House

PostPosted: Sun Dec 12, 2004 2:37 pm    Post subject: Reply with quote

Frank,

Thanks for your reply.
I am trying to tie my knots in understanding this.

I have th following questions.


(1) In the table given I find 'E9' for 'Z' but in the solution I find 'EA'!

(2) Will the solution change the collating sequence as

NOPQRSTUVWXYZM ( M to be considered after Z )

or

ZNOPQRSTUVWXYM (M to be treated in lieu of Z ) ?

Thanks
YSMVS
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Sun Dec 12, 2004 7:56 pm    Post subject: Reply with quote

(1) If you use D4E9, then 'M' will collate the same as 'Z'. Since you want 'M' to collate after 'Z', you need to use D4EA.

(2) NOPQRSTUVWXYZM ( M to be considered after Z )

The ALTSEQ table is 256 bytes. The default is the EBCDIC table which runs from X'00'-X'FF'. ALTSEQ CODE=(D4EA) changes the entry in the table at offset X'D4' to X'EA'. So when we sort an 'M' (X'D4'), we pick up the character after 'Z' (X'EA') from the table instead of the 'M' (X'D4'). Thus, X'EA' is used for 'M' instead of X'D4'. None of the other entries in the table are changed by D4EA, so the offset at X'E9' ('Z') is still X'E9' ('Z').

If you wanted 'M' to collate the same as 'Z', you would use ALTSEQ CODE=(D4E9), so when we sort an 'M' (X'D4') we would pick up the character 'Z' (X'E9') from the table instead of the 'M' (X'D4').

To get the equivalent of:

ZNOPQRSTUVWXYM

you'd need to use ALTSEQ CODE=(D4E9,E9D4). That would exchange 'M' and 'Z'.

If you know Assembler, then think of the ALTSEQ table as working like the translation table for TR and TRT. You can read about how those instructions work in "Principles of Operation".
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group