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

How to determine low values are present in a field


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

Active User


Joined: 31 Jan 2008
Posts: 148
Location: Chennai, India

PostPosted: Wed May 19, 2010 10:23 pm
Reply with quote

Hi All,

My requirement is to fetch rows from a table having low vaules for a particular field in the table. I tried the below sample query

Quote:
select empno
from employee
where remarks = x'00'


But its not fetching those rows which contains low values in the remarks field.
The datatype of remarks field is char(70).

Please correct me where i am doing a mistake. Thanks
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1356
Location: Israel

PostPosted: Wed May 19, 2010 10:29 pm
Reply with quote

In a cobol program:
Code:
01  WS-REMARKS     PIC X(70).

MOVE LOW-VALUES TO WS-REMARKS

SELECT EMPNO
   FROM EMPLOYEE
   WHERE REMARKS = :WS-REMARKS
Back to top
View user's profile Send private message
murugan_mf

Active User


Joined: 31 Jan 2008
Posts: 148
Location: Chennai, India

PostPosted: Thu May 20, 2010 10:08 am
Reply with quote

Thanks Marso.

But i am executing the query using spufi. Is there any way to use low values directly in the query?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Thu May 20, 2010 12:25 pm
Reply with quote

how about something like CHAR(X'00',70)
Back to top
View user's profile Send private message
Ronald Burr

Active User


Joined: 22 Oct 2009
Posts: 293
Location: U.S.A.

PostPosted: Thu May 20, 2010 5:26 pm
Reply with quote

CHAR(x'00',70) would not work. The result is a 70 byte field in which the first byte is x'00' and all remaining bytes are spaces. According to the manual:

If the length of string-expression ( in this case, x'00' ) is less than the length attribute of the result ( in this case, 70 ), the result is padded with blanks to the length of the result.

Instead, try:
Code:
CHAR(REPEAT(X'00',70))
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Thu May 20, 2010 6:04 pm
Reply with quote

Ronald Burr wrote:
Instead, try:
Code:
CHAR(REPEAT(X'00',70))


Thanks Ronald, This was helpful. I never tried this before..
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 count contained values of several col... DB2 5
No new posts To Unstring spaces in a field COBOL Programming 3
No new posts Help required to reset decimal points... DFSORT/ICETOOL 10
No new posts Sorting Date Field DFSORT/ICETOOL 4
No new posts how to eliminate null indicator value... DB2 7
Search our Forums:


Back to Top