Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

LOW VALUES in DB2 columns

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
pdevidas12

New User


Joined: 28 Feb 2010
Posts: 3
Location: Pune

PostPosted: Mon Aug 30, 2010 6:14 pm    Post subject: LOW VALUES in DB2 columns
Reply with quote

HI
WHEN WE HAVE LOW VALUES IN COLUMN SUPPOSE NAME SO HOW I CAN GET ALL THE ROWS WHERE I HAVE THE LOW VALUES. LIKE
SELECT * FROM TABLE WHERE NAME = "PDEVDAS12"
SO WHAT WE HAVE TO GIVE IN NAME TO FIND OUT ALL COLUMN WHERE VALUES ARE "LOW VALUES"

THANKS
PDEVIDAS12IN c
Back to top
View user's profile Send private message

enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10256
Location: italy

PostPosted: Mon Aug 30, 2010 6:34 pm    Post subject: Reply to: LOW VALUES IN DB2 COLUMN
Reply with quote

first, do not write in capital letters
second, define LOW VALUES
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6967
Location: porcelain throne

PostPosted: Mon Aug 30, 2010 6:34 pm    Post subject:
Reply with quote

Quote:
SELECT *

that is very poor sql. you should select only those columns that you need.

I will attribute your wording of your question as a language thing.

low-values is a COBOL literal, has nothing to do with db2

you want to select 'what' WHEN NAME = X'0000000000' ?
the literal has to be the same number of characters as the column NAME

if NAME is CHAR(10) the literal has to be x'00000000000000000000'

if NAME is varchar you will need to substring the literal for the length of the column NAME length.

are you sure that all bytes of the column NAME are binary zeroes?
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Mon Aug 30, 2010 6:43 pm    Post subject: Re: LOW VALUES IN DB2 COLUMN
Reply with quote

pdevidas12 wrote:
HI
WHEN WE HAVE LOW VALUES IN COLUMN SUPPOSE NAME


What is the definition of the column in the table?
Back to top
View user's profile Send private message
dick scherrer

Site Director


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

PostPosted: Mon Aug 30, 2010 8:11 pm    Post subject:
Reply with quote

Hello,

Is this a person's name rather than a database column name?

What if the value is not x'0000000000. . .' but rather multiple non-printable characters (i.e. x'122334. . .'? A test for "low-values" will be not-equal, but i suspect you would want these identified.
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Mon Aug 30, 2010 8:37 pm    Post subject:
Reply with quote

Okay, based on a pure guess, please try this:
Code:
SELECT NAME FROM TABLE
WHERE LENGTH (NAME) > LENGTH (REPLACE(NAME, X?00?,'') ;
Back to top
View user's profile Send private message
dick scherrer

Site Director


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

PostPosted: Mon Aug 30, 2010 8:42 pm    Post subject:
Reply with quote

Hi Anuj,

Why is LENGTH mentioned?

Devidas, if you want help, you have to participate. . .
Back to top
View user's profile Send private message
pdevidas12

New User


Joined: 28 Feb 2010
Posts: 3
Location: Pune

PostPosted: Tue Aug 31, 2010 6:45 pm    Post subject: Reply to: LOW VALUES in DB2 columns
Reply with quote

First Sorry to Moderator,,,, Next time onward I will post queries in small letters only.

I have faced this question in interview, It may possible he/she may have confused me with LOW-VALUES of DB2 and COBOL. But if at all there wont be any "LOW VALUES" in DB2?

thanks
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6967
Location: porcelain throne

PostPosted: Tue Aug 31, 2010 6:50 pm    Post subject:
Reply with quote

low-values is a COBOL figurative constants that means binary-zeroes.

and no, it is conceivable to find binary-zeros in char data type columns.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Sorting of hex values Saurabh_mi DFSORT/ICETOOL 10 Thu May 25, 2017 3:49 pm
No new posts Replace values in the input data Vikas Maharnawar DFSORT/ICETOOL 10 Thu May 11, 2017 2:18 pm
No new posts unload data from table with lob columns farhad_evan DB2 0 Sat Apr 22, 2017 1:32 pm
No new posts Compare two files and subtract values ameetmund DFSORT/ICETOOL 7 Fri Mar 31, 2017 3:35 pm
No new posts Check Binary Values for symbols gandikk CA Products 3 Tue Mar 21, 2017 5:11 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us