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: 1250
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: 6970
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
This topic is locked: you cannot edit posts or make replies. Comparing current time with the time ... arunsoods SYNCSORT 1 Mon Oct 30, 2017 4:07 pm
This topic is locked: you cannot edit posts or make replies. Incrementing current time field by 30... arunsoods DFSORT/ICETOOL 11 Thu Oct 26, 2017 3:22 pm
No new posts sending email from jcl using the mail... niloyarp JCL & VSAM 5 Tue Oct 10, 2017 12:32 pm
No new posts Extend the decimal values in DIVISION Balaryan DFSORT/ICETOOL 3 Thu Oct 05, 2017 4:05 pm
No new posts sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm

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