View previous topic :: View next topic
|
Author |
Message |
rarvins
New User
Joined: 24 Jan 2007 Posts: 59 Location: Texas
|
|
|
|
Hi,
Is there a fucntion/way by which I can find the day of week in cobol. In DB2 there is a day of week function which takes a date as input and returns the day of week i.e. 01 - Sunday, 02 - Monday... I need to imitate the same functionality in cobol. Is there a function / way ?
Cheers,
Rarvins |
|
Back to top |
|
|
Itanium
Active User
Joined: 22 Jan 2006 Posts: 114 Location: India
|
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
You might to check the reference manual for the version of COBOL you are using. |
|
Back to top |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
Use the INTEGER OF DATE function, divide the value returned by 7 - the remainder is the DOW.
I don't recall what their numeric values are (and they may also change with the INTDATE compiler option you use), so just pick a date whose DOW you know (e.g. today's date) and build your DOW table from that.
I would also code the INTDATE option in a CBL stmt immediately prior to the IDENTIFICATION DIVISION stmt of your pgm. This will assure that the same "start" is used for every execution of your pgm. |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
Accept pic-9 from day-of-week.
pic-9 1 = monday 7 = sunday
The rest is up to you. |
|
Back to top |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
That only works for the current date. |
|
Back to top |
|
|
|