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

How Max work on CHAR colmn


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

New User


Joined: 20 Dec 2007
Posts: 29
Location: India

PostPosted: Sat Jan 26, 2008 4:55 pm
Reply with quote

how MAX on a CHAR column work?
Wha will be result of query if contain both number and charcter.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10903
Location: italy

PostPosted: Sat Jan 26, 2008 5:11 pm
Reply with quote

it depends ...

in a plain ebcdic environment letters come before numbers
max("A","Z","0","9") will be "9"
min("A","Z","0","9") will be "A"

in an ascii environment the other way around
max("A","Z","0","9") will be "Z"
min("A","Z","0","9") will be "0"

also remember that in an ebcdic environment the letters are not contiguos

there are also other concerns.:
...strict non_strict equality
in a strict equality "AA " will be different from "AA"

... case sensitivity
Back to top
View user's profile Send private message
Ashsih

New User


Joined: 20 Dec 2007
Posts: 29
Location: India

PostPosted: Sat Jan 26, 2008 5:22 pm
Reply with quote

Thanks!!!!!!!!!!!
Supposed i am using DB2 and my colm has follwing valuse then what will be the o/p of MAX query.

ABC
A23
23A
999

o/p - ?
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Sun Jan 27, 2008 2:04 am
Reply with quote

Hello Ashsih,

Your answer was given above - in ebcdic, numbers are "higher" than letters.

In your example data, 999 would be the highest.
Back to top
View user's profile Send private message
Ashsih

New User


Joined: 20 Dec 2007
Posts: 29
Location: India

PostPosted: Mon Jan 28, 2008 10:06 am
Reply with quote

Thanks!!!!!!!
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Mon Jan 28, 2008 9:23 pm
Reply with quote

You're welcome icon_smile.gif

d
Back to top
View user's profile Send private message
View previous topic : : View next topic  
Post new topic   Reply to topic All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts sort to find out the char which repea... Mainframe Interview Questions 10
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts isfline didnt work in rexx at z/OS ve... CLIST & REXX 7
No new posts Exclude rows with > than x occurre... DFSORT/ICETOOL 6
No new posts Using PARM=('JPn"&SYMBOL&quo... DFSORT/ICETOOL 2
Search our Forums:


Back to Top