Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
How to determine low values are present in a field

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: How to determine low values are present in a field
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: 1243
Location: Israel

PostPosted: Wed May 19, 2010 10:29 pm    Post subject:
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    Post subject:
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: 6968
Location: porcelain throne

PostPosted: Thu May 20, 2010 12:25 pm    Post subject:
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    Post subject:
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    Post subject:
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    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 Working with hex values in Filemanage... Emile Straker IBM Tools 0 Tue Sep 12, 2017 1:42 am
No new posts DB2 NULL Values display V S Amarendra Reddy DB2 3 Thu Sep 07, 2017 6:59 pm
No new posts Moving values to a variable of copybo... Vignesh Sid COBOL Programming 6 Wed Sep 06, 2017 1:04 pm
No new posts Remove leading spaces from numeric field rexx77 SYNCSORT 6 Wed Sep 06, 2017 2:15 am
No new posts JES2 job size field matching Windows ... SRICOBSAS All Other Mainframe Topics 4 Tue Sep 05, 2017 5:49 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us