View previous topic :: View next topic
|
Author |
Message |
srinathangya
New User
Joined: 19 Dec 2005 Posts: 77
|
|
|
|
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 |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10872 Location: italy
|
|
|
|
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 |
|
|
arun.masilamani
New User
Joined: 26 Jun 2008 Posts: 4 Location: Chennai
|
|
|
|
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 |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
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 |
|
|
arvind.m
Active User
Joined: 28 Aug 2008 Posts: 205 Location: Hyderabad
|
|
|
|
check the below code
Code: |
COMPUTE DAY-OF-WEEK = FUNCTION MOD (FUNCTION INTEGER-OF-DATE (Input date)7).
|
|
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
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 |
|
|
|