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 

compare single date to range in week

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


Joined: 08 Oct 2004
Posts: 192
Topics: 89

PostPosted: Fri Jun 10, 2005 1:30 am    Post subject: compare single date to range in week Reply with quote

Hi,

I want to compare single date with range in week date mm/dd/yy format in COBOL

ex 01/01/05 with 01/01/05 to 01/07/05 in cobol code

How to do it in cobol. If possible pls. provide code.

Thanks in advance
Nadh.

I searched for this topic, but i could not find sol.
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


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

PostPosted: Fri Jun 10, 2005 8:03 am    Post subject: Reply with quote

Nadh,

You can add 7 days to your beginning date to get the ending date. Check this link which discusses about adding and subtracting days to gregorian date.

http://www.mvsforums.com/helpboards/viewtopic.php?t=2261&highlight=date

Hope this helps...

Cheers

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


Joined: 08 Jun 2005
Posts: 4
Topics: 1

PostPosted: Fri Jun 10, 2005 9:46 am    Post subject: Reply with quote

In WORKING-STORAGE:

01 WS-FROM-YYMMDD.
05 WS-FROM-YY PIC X(02).
05 WS-FROM-MM PIC X(02).
05 WS-FROM-DD PIC X(02).

01 WS-TO-YYMMDD.
05 WS-TO-YY PIC X(02).
05 WS-TO-MM PIC X(02).
05 WS-TO-DD PIC X(02).

01 WS-TEST-YYMMDD.
05 WS-TEST-YY PIC X(02).
05 WS-TEST-MM PIC X(02).
05 WS-TEST-DD PIC X(02).

In PROCEDURE DIV:

*** MOVE the appropriate parts of the dates in question
*** (i.e., the FROM and TO dates of the week range
*** as well as date to be tested) to the structures above.
*** Compare as follows:

IF WS-TEST-YYMMDD >= WS-FROM-YYMMDD
AND WS-TEST-YYMMDD <= WS-TO-YYMMDD
DISPLAY 'DATE IS WITHIN RANGE'
ELSE
DISPLAY 'DATE IS NOT WITHIN RANGE'
END-IF
Back to top
View user's profile Send private message
nadh
Intermediate


Joined: 08 Oct 2004
Posts: 192
Topics: 89

PostPosted: Mon Jun 13, 2005 4:33 am    Post subject: Reply with quote

Thanks a lot.

nadh
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