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
 

 

Resultant of the Query If '<='is specified as mentioned

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
Sachinincsc

New User


Joined: 01 Oct 2008
Posts: 11
Location: Philadelphia, USA

PostPosted: Mon Oct 06, 2008 3:07 am    Post subject: Resultant of the Query If '<='is specified as mentioned
Reply with quote

wat will be the resultant of the QUERY is the MASTER_ID exists in the table..
EXEC SQL
DECLARE C3_TESTCUR CURSOR FOR
SELECT MASTER_ID
FROM SCHED_DATE_TABLE
WHERE COMPANY_CODE = :WS-IN-COMP-CODE
AND MASTER_ID <= :SAVE-END-POL-NUM
ORDER BY MASTER_ID DESC
OPTIMIZE FOR 1 ROW
END-EXEC.

Which operator will return the value ? = or < ( if MASTER_ID is present in the table).
Back to top
View user's profile Send private message

dick scherrer

Site Director


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

PostPosted: Mon Oct 06, 2008 4:14 am    Post subject:
Reply with quote

Hello,

Your question is not clear. . .

Show some sample rows (using both columns values) and someone will be able to explain what would be returned.

Quote:
Which operator will return the value ? = or < ( if MASTER_ID is present in the table).
If i understand your question rows that are matching the company code and are equal or less than the SAVE-END-POL-NUM will qualify.

I do not understand why you separate the "=" and the "<" in your question icon_confused.gif
Back to top
View user's profile Send private message
Sachinincsc

New User


Joined: 01 Oct 2008
Posts: 11
Location: Philadelphia, USA

PostPosted: Mon Oct 06, 2008 7:18 pm    Post subject: Reply to: Resultant of the Query If '<='is specified as m
Reply with quote

Dick,

I only coded this cursor and was concerned if the MASTER-ID is equal to save-end-pol-num what it will return. ( SAVE-END-POL-NUM or lesser value).

But things are clear now. Thanks 4 your time.

This CURSOR may be used to fetch the second highest value of a particular feild from a particular (passed logically) in a table.

My requirement was to establish the following START command thru a DB2 cursor. so i coded the above mentioned cursor.

START SCHED1 KEY NOT GREATER SCHED-REC-KEY ( applied on a VSAM FILE)

Works fine for me

Thanks DIck

Sachin
Back to top
View user's profile Send private message
dick scherrer

Site Director


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

PostPosted: Tue Oct 07, 2008 12:21 am    Post subject: Reply to: Resultant of the Query If '<='is specified as m
Reply with quote

You're welcome - good luck icon_smile.gif

d
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 Join in SQL Query vickey_dw DB2 2 Tue Jan 17, 2017 12:15 am
This topic is locked: you cannot edit posts or make replies. MQ setup query mohitsaini Java & MQSeries 4 Sun Jan 08, 2017 1:53 am
No new posts DB2 query Using Recursion, Converting... smilewithashu2 DB2 1 Tue Jan 03, 2017 12:50 pm
No new posts SQL query to run through list of valu... Ni3-db2 DB2 14 Wed Dec 14, 2016 9:52 am
This topic is locked: you cannot edit posts or make replies. Db2 SQL query to convert rows into co... subratarec DB2 5 Thu Nov 17, 2016 4:51 pm


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