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

Day of week in Cobol


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
rarvins

New User


Joined: 24 Jan 2007
Posts: 59
Location: Texas

PostPosted: Fri Jan 11, 2008 4:15 pm
Reply with quote

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
View user's profile Send private message
Itanium

Active User


Joined: 22 Jan 2006
Posts: 114
Location: India

PostPosted: Fri Jan 11, 2008 7:54 pm
Reply with quote

check the link:
http://publib.boulder.ibm.com/infocenter/comphelp/v7v91/index.jsp?topic=/com.ibm.aix.cbl.doc/rlpsacce.htm

Try Google before posting.
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Fri Jan 11, 2008 8:57 pm
Reply with quote

You might to check the reference manual for the version of COBOL you are using.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Sat Jan 12, 2008 1:04 am
Reply with quote

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
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Sat Jan 12, 2008 8:17 am
Reply with quote

Accept pic-9 from day-of-week.
pic-9 1 = monday 7 = sunday

The rest is up to you.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Sat Jan 12, 2008 11:03 am
Reply with quote

That only works for the current date.
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 -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts Generate random number from range of ... COBOL Programming 3
Search our Forums:

Back to Top