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
 

 

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: 1224
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: 6966
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 INVALID FIELD OR CONSTANT IN SORTOF ?? Ron Klop DFSORT/ICETOOL 8 Wed Jan 11, 2017 3:44 pm
No new posts SQL query to run through list of valu... Ni3-db2 DB2 14 Wed Dec 14, 2016 9:52 am
No new posts Performing arithmetic on input field zh_lad DFSORT/ICETOOL 31 Tue Dec 06, 2016 8:04 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts Overlaying one set of charater values... Kevin Lindsley SYNCSORT 7 Sat Nov 05, 2016 3:21 am


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