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 

Validate Month end is sunday in COBOL

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


Joined: 26 Sep 2003
Posts: 130
Topics: 36

PostPosted: Tue Feb 03, 2009 5:04 pm    Post subject: Validate Month end is sunday in COBOL Reply with quote

Hi All,

I want to validate the month end is Sunday or not using COBOL. If month end is Sunday I need to display it is invalid date else valid date.

Input
20090430
20090531
20090630
etc

Output
20090430 valid date
20090531 invalid date
20090630 valid date
etc

Thank in advance
_________________
Regards,
Chandra
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Tue Feb 03, 2009 6:25 pm    Post subject: Reply with quote

chandra,

untested code

Code:

01 WS-INP-DATE           PIC 9(8).                 
01 WS-DIVIDE-ANSWER      PIC S9(08) COMP.           
01 WS-INTEGER            PIC S9(08) COMP.           
01 WS-REMAINDER          PIC S9(04) COMP.

COMPUTE WS-INTEGER = FUNCTION INTEGER-OF-DATE(WS-INP-DATE)
                                                         
DIVIDE WS-INTEGER  BY 7 GIVING WS-DIVIDE-ANSWER           
                        REMAINDER WS-REMAINDER           
                                                         
ADD 1 TO WS-REMAINDER                                     
                                                         
IF WS-REMAINDER = 1                                       
   DISPLAY 'INVALID DATE : ' WS-INP-DATE                 
ELSE                                                     
   DISPLAY 'VALID DATE   : ' WS-INP-DATE                 
END-IF                                                   

_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
chandra
Beginner


Joined: 26 Sep 2003
Posts: 130
Topics: 36

PostPosted: Wed Feb 04, 2009 12:04 pm    Post subject: Reply with quote

Thank you very much Kolusu, I will test and let you know is it working or not.
_________________
Regards,
Chandra
Back to top
View user's profile Send private message
chandra
Beginner


Joined: 26 Sep 2003
Posts: 130
Topics: 36

PostPosted: Wed Feb 04, 2009 5:29 pm    Post subject: Reply with quote

Hi Kolusu,

Thanks once again.

The above code is working fine.
_________________
Regards,
Chandra
Back to top
View user's profile Send private message
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