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

High and Low values in UNICODE database


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

New User


Joined: 22 Dec 2006
Posts: 7
Location: Singapore

PostPosted: Sat Dec 23, 2006 7:07 am
Reply with quote

Hi,
I have an issue with the selecting of records from a UNICODE DB2 database when using the high and low values. Can anyone let me know how I can read all the records in the database using high and low values. The query I used is

select * from VC_CURRENCY
where CURRENCY_CODE >= :WS-CCY-LOW and
CURRENCY_CODE <= :WS-CCY-HIGH ;

I am getting a -302 error when this query is executed. I have some double byte characters in this table and need to fetch them.
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1448
Location: Chicago, IL

PostPosted: Sat Dec 23, 2006 12:08 pm
Reply with quote

How "CURRENCY_CODE" is defined in the table VC_CURRENCY

Also what is the definition for WS-CCY-LOW & WS-CCY-HIGH.
Back to top
View user's profile Send private message
sheela_aks

New User


Joined: 22 Dec 2006
Posts: 7
Location: Singapore

PostPosted: Mon Dec 25, 2006 2:22 pm
Reply with quote

The CURRENCY_CODE is defined as CHAR(3) and the WS-LOW-VALUE and WS-HIGH-VALUE is defined as LOW VALUE and HIGH VALUE respectively, in the working storage division of the COBOL program.


Please let me know if there is any restrictions for Numeric fields as well.
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1448
Location: Chicago, IL

PostPosted: Mon Dec 25, 2006 9:29 pm
Reply with quote

sheela,

SQL -302 :-
THE VALUE OF INPUT VARIABLE NUMBER position-number IS INVALID OR TOO LARGE FOR THE TARGET COLUMN OR THE TARGET VALUE

So what I meant to ask was... What is the PIC clause defined for WS-LOW-VALUE and WS-HIGH-VALUE.
Back to top
View user's profile Send private message
sheela_aks

New User


Joined: 22 Dec 2006
Posts: 7
Location: Singapore

PostPosted: Tue Dec 26, 2006 8:06 pm
Reply with quote

The size of the working storage fields are defined as CHAR(3), same as it is defined in the database.
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1448
Location: Chicago, IL

PostPosted: Tue Dec 26, 2006 10:50 pm
Reply with quote

Then atleast dont have any problem with length of the vars...

BTW, what does this query accomplish... could you explain little bit...
Quote:
select * from VC_CURRENCY
where CURRENCY_CODE >= :WS-CCY-LOW and
CURRENCY_CODE <= :WS-CCY-HIGH ;
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Wed Dec 27, 2006 12:53 am
Reply with quote

Hello,

Would "select * from VC_CURRENCY" do what you need? If not, why not?
Back to top
View user's profile Send private message
sheela_aks

New User


Joined: 22 Dec 2006
Posts: 7
Location: Singapore

PostPosted: Mon Jan 08, 2007 4:45 pm
Reply with quote

Hi,
Actually the given SQL is only a part of the complete where clause. The same condition is being checked for another 5 fields in the database. The idea is to use only one SQL query to fetch records even if only one of the fields have data as input. For eg. I have these 5 fields in the search condition on the screen (currency code, currency name, currency numeric code, currency char code and status). If I would like to fetch all the records which are of status 'ACT' then the other four fields will not have any input.

One way of achieiving this is to check if each of these fields are entered and based on the different permutations and combinations the where clause will have to be written.

To avoid this, we have written a generic query with low and high values so that this can be achieved with just one SQL query statment.

I hope I am being clear now. This single query works fine for the EBCIDIC database but does not work for the UNICODE database.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts What database does Jobtrac use CA Products 4
No new posts Null values are considered in Total c... DFSORT/ICETOOL 6
No new posts ISRSUPC search utility - using high l... TSO/ISPF 2
Search our Forums:

Back to Top