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

SQL to update the flags of the reamaining fields


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
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
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

Moderator Emeritus


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

PostPosted: Wed Nov 19, 2008 8:12 am
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
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

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Wed Nov 19, 2008 1:48 pm
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Read a flat file and update DB2 table JCL & VSAM 2
No new posts how to update an ISR appl var from an... TSO/ISPF 8
No new posts Concatenate 2 fields (usage national)... COBOL Programming 2
No new posts Cobol COMP-2 fields getting scrambled... Java & MQSeries 6
No new posts Converting unpacked fields to pack us... SYNCSORT 4
Search our Forums:

Back to Top