MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Day of week

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Sun Dec 01, 2002 10:45 pm    Post subject: Day of week Reply with quote

Code:

01  WS-DIVIDE-ANSWER            PIC S9(08) COMP.
01  WS-INTEGER                  PIC S9(08) COMP.   
01  WS-REMAINDER                PIC S9(04) COMP. 

01  WS-CCYYMMDD-NUM             PIC 9(08).               
01  WS-CCYYMMDD                 REDEFINES WS-CCYYMMDD-NUM.
    05  WS-CCYYMMDD-CCYY-NUM    PIC 9(04). 
    05  WS-CCYYMMDD-CCYY        REDEFINES WS-CCYYMMDD-CCYY-NUM.
        10  WS-CCYYMMDD-CC      PIC 9(02).
        10  WS-CCYYMMDD-YY      PIC 9(02). 
    05  WS-CCYYMMDD-MM          PIC 9(02).
    05  WS-CCYYMMDD-DD          PIC 9(02).   


01  WS-DOW-TABLE. 
    05  FILLER                  PIC X(21) VALUE 
                               'SUNMONTUEWEDTHUFRISAT'.
01  FILLER                      REDEFINES WS-DOW-TABLE.
    05  WS-DOW-ENTRY            PIC X(03) OCCURS 7 TIMES. 
01  WS-DAY-OF-WEEK              PIC X(03).           


10000-GET-DAYOFWEEK.

          COMPUTE WS-INTEGER = FUNCTION INTEGER-OF-DATE(WS-CCYYMMDD-NUM).

          DIVIDE WS-INTEGER  BY 7 GIVING WS-DIVIDE-ANSWER 
                              REMAINDER WS-REMAINDER.

          ADD 1 TO WS-REMAINDER.

          MOVE WS-DOW-ENTRY (WS-REMAINDER) TO WS-DAY-OF-WEEK.

Back to top
View user's profile Send private message Send e-mail Visit poster's website  
Manas Biswal
Intermediate


Joined: 29 Nov 2002
Posts: 382
Topics: 27
Location: Chennai, India

PostPosted: Mon Dec 02, 2002 5:52 am    Post subject: Reply with quote

If we are using LE-COBOL, then we can directly use the CEEDYWK service to calculate the day of the week.

Regards,
Manas
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger  
Dibakar
Advanced


Joined: 02 Dec 2002
Posts: 700
Topics: 63
Location: USA

PostPosted: Tue Dec 17, 2002 4:35 am    Post subject: Reply with quote

I am doing VS COBOL II - CICS coding. When I use statement -

COMPUTE WS-CNT = FUNCTION INTEGER-OF-DATE(11111111)

And following error I am getting -

I "FUNCTION" was specified as an informational word in the current reserved wo...
used may be different from the IBM-supplied default. Refer to VS COBOL II A...
Reference for information on reserved words.

S "FUNCTION" was not defined as a data-name. The statement was discarded.

S "INTEGER-OF-DATE" was invalid. Skipped to the next verb, period or procedur...

I looked in VS COBOL II manual and "INTEGER-OF-DATE" is not there. Am I right to conclude that VS COBOL II doesn't have functions.
Back to top
View user's profile Send private message Send e-mail  
Manas Biswal
Intermediate


Joined: 29 Nov 2002
Posts: 382
Topics: 27
Location: Chennai, India

PostPosted: Tue Dec 17, 2002 7:44 am    Post subject: Reply with quote

Hi Dibakar,

What I do know is that the function INTEGER-OF-DATE is supported on COBOL/370 and COBOL for MVS. Never have used that function in VS COBOL II. By the way if you are writing a CICS-COBOL application program, why don't you use FORMATTIME. That should be able to solve most of the date problems.

Regards,
Manas
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger  
Dibakar
Advanced


Joined: 02 Dec 2002
Posts: 700
Topics: 63
Location: USA

PostPosted: Wed Dec 18, 2002 2:33 am    Post subject: Reply with quote

Yes, I am using FormatTime but wanted to experiment with Cobol functions.
Back to top
View user's profile Send private message Send e-mail  
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group