IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Order By CHAR fields in DB2


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Geetha B

New User


Joined: 24 Nov 2007
Posts: 12
Location: chennai

PostPosted: Thu Jul 01, 2010 5:52 pm
Reply with quote

Hi,

We have a requirement where we need to order by on a char field in such a way that we will get all the char fields which has numeric values and then we should get char fields containing other than numeric values.


For e.g.:

Table column has following values:
AAAA
BBBB
1009
100A
1010
101B
2000
3010

req o/p:

1009
1010
2000
3010
100A
101B
AAAA
BBBB

Please let us know how we can achieve the above results.

Thanks
Back to top
View user's profile Send private message
GuyC

Senior Member


Joined: 11 Aug 2009
Posts: 1281
Location: Belgium

PostPosted: Thu Jul 01, 2010 6:18 pm
Reply with quote

in Unicode you already get 0..9 A..Z
in Ebcdic you get A..Z0..9
so you can experiment to get your data in the correct CCSID

or use collation_key()
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu Jul 01, 2010 8:04 pm
Reply with quote

Hello,

Depending on your overall requirement (not just this one sequence), suggest you convince "them" that on the mainframe, the sequence is not the same as on the pc.

Even when this process "works" there will very likely be problems when the data is used in other mainframe processes. The A will compare less than the zero in all of the program code. . .
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Rotate partition-logical & physic... DB2 0
No new posts Exclude rows with > than x occurre... DFSORT/ICETOOL 6
No new posts Concatenate 2 fields (usage national)... COBOL Programming 2
No new posts DB2 Load - Sort Or order BY DB2 1
Search our Forums:

Back to Top