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

Program for Day of Week


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

New User


Joined: 19 Dec 2005
Posts: 77

PostPosted: Wed May 20, 2009 12:40 pm
Reply with quote

Hi Buddies,

Could anyone get me a program in Cobol to find the Day of the Week?


Thanks in advance.

Regards,
Srinath.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Wed May 20, 2009 12:52 pm
Reply with quote

this is a help forum, not a do it for me or search for me

if You search the forums You will find lots of suggestions
Back to top
View user's profile Send private message
arun.masilamani

New User


Joined: 26 Jun 2008
Posts: 4
Location: Chennai

PostPosted: Wed May 20, 2009 4:42 pm
Reply with quote

Why dont you try the following code for your requirement ??

Code:
WORKING-STORAGE SECTION.                           
                                                   
  01  WS-CURRENT-DT.                               
      05  WS-CURR-YY                 PIC X(2).     
      05  WS-CURR-MM                 PIC X(2).     
      05  WS-CURR-DD                 PIC X(2).     
                                                   
PROCEDURE DIVISION.                                 
                                                   
    PERFORM 1000-INITILIZATION-PARA THRU 1000-EXIT.
    STOP RUN.                                       
                                                   
1000-INITILIZATION-PARA.                           
    ACCEPT WS-CURR-DD          FROM DAY-OF-WEEK.   
    DISPLAY WS-CURRENT-DT.                         
                                                   
1000-EXIT.                                         
    EXIT.                                           
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Wed May 20, 2009 4:51 pm
Reply with quote

It's been suggested that you search the forums as this question has been asked numerous times.

Have you searched for "day-of-week"?

I believe you'll get many hits....

Regards,
Back to top
View user's profile Send private message
arvind.m

Active User


Joined: 28 Aug 2008
Posts: 205
Location: Hyderabad

PostPosted: Fri May 22, 2009 3:44 pm
Reply with quote

check the below code

Code:

COMPUTE DAY-OF-WEEK = FUNCTION MOD (FUNCTION INTEGER-OF-DATE (Input date)7).
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Fri May 22, 2009 10:07 pm
Reply with quote

Click on the following link -

ibmmainframes.com/viewtopic.php?p=125110&highlight=#125110

The code in the above link doesn't rely upon the date being today's date when determining the day of the week.

You will need to define an OCCURS 7 array, which contains the alphabetic days of the week.

Your COBOL version/release must be (at a minimum), COBOL/370 (early 1990's) as this code uses INTRINSIC FUNCTIONS.

Otherwise, for OS/VS COBOL or VS/COBOL II, you'd have to use the LE Callable Date routines counterparts of these INTRINSIC FUNCTIONS, providing that LE is installed in your LPAR.

Regards,
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 Using API Gateway from CICS program CICS 0
No new posts DB2 Event passed to the Application P... DB2 1
No new posts How to pass the PARM value to my targ... COBOL Programming 8
No new posts REXX code to expand copybook in a cob... CLIST & REXX 2
No new posts EZT program to build a flat file with... All Other Mainframe Topics 9
Search our Forums:

Back to Top