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
 
SQL to update the flags of the reamaining fields

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

New User


Joined: 19 Nov 2008
Posts: 3
Location: India

PostPosted: Wed Nov 19, 2008 4:50 am    Post subject: SQL to update the flags of the reamaining fields
Reply with quote

Doubt to write a SQL:

I am having a table,with different fields such as date,week_end ,month_end,year_end etc
depends on the date I need to update the flags of the reamaining fields
eg: if date is 30/12/2010
week_end(last working day of the week) ='Y'
month_end(last working day of month) ='Y'
year_end (last working day of year) ='Y'

This date always varies and depends on this date I need to set the flags to the remaining fields
As I know only the basics of DB2,please anyone give me the complete SQL for the above mentioned scenario


Thanks in advance
Kimmy
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: Wed Nov 19, 2008 8:12 am    Post subject:
Reply with quote

Hello Kimmy and welcome to the forum,

This does not appear to be something to handled by a simple sql query.

Somehow, all of the business rules surrounding calendar processing for your organization need to be considered. For example, what it the last day of a month is on Monday, but that is a holiday?
Back to top
View user's profile Send private message
kimmybunn

New User


Joined: 19 Nov 2008
Posts: 3
Location: India

PostPosted: Wed Nov 19, 2008 1:35 pm    Post subject:
Reply with quote

Hi Thanks alot for the reply.
Yes whatever you said is correct.Last working day(Shouldnt be a bank holiday).If last day of month is a bank holiday then the last working day is Friday.
I have gone through some of the old postings.Is it possible to use case staement or a procedure for doing the same
Expecting valuable informations from experts
Thanks
Kimmy
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10326
Location: italy

PostPosted: Wed Nov 19, 2008 1:48 pm    Post subject: Reply to: Doubt to write a SQL:
Reply with quote

calendars are a murky issue, that should not be solved by individuals,
but at organization level providing the proper tools and standards
( standards at least )

You better speak with somebody higher in Your organization

in all the organization I worked in, there was such an approach
and yearly according to the organization product life cycle and to the legal issues
all the relevant calendar management routines were reviewed
Back to top
View user's profile Send private message
kimmybunn

New User


Joined: 19 Nov 2008
Posts: 3
Location: India

PostPosted: Wed Nov 19, 2008 6:49 pm    Post subject:
Reply with quote

OK thanks for the information.
But from my knowledge,dayofweek function is available in db2 (eg:dayofweek('18/01/2008')and with this I can get the numeric values such as 1, 2, ...7.using this value I can update the table for the field 'week_end' rite?
For the time being I can hardcode the bank holidays for this 2008 year.
Is it a good idea to implement
Please advise
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 Subtract the ZD fields to provide neg... Balaryan DFSORT/ICETOOL 4 Wed Oct 11, 2017 10:51 pm
No new posts Update table without cursor Ron Klop DB2 3 Wed Oct 11, 2017 1:06 pm
No new posts Addition of two records on 2 fields amar143 SYNCSORT 8 Tue Oct 03, 2017 11:14 am
No new posts Split file based on comparsion to 2 f... Div Grad DFSORT/ICETOOL 3 Thu Jul 27, 2017 9:16 pm
No new posts How to write Specific Fields from Mul... Padhu SYNCSORT 6 Thu Jul 06, 2017 10:26 am

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