View previous topic :: View next topic |
Author |
Message |
nadh Intermediate
Joined: 08 Oct 2004 Posts: 192 Topics: 89
|
Posted: Fri Jun 10, 2005 1:30 am Post subject: compare single date to range in week |
|
|
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 |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
|
|
Back to top |
|
|
BruceG Beginner
Joined: 08 Jun 2005 Posts: 4 Topics: 1
|
Posted: Fri Jun 10, 2005 9:46 am Post subject: |
|
|
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 |
|
|
nadh Intermediate
Joined: 08 Oct 2004 Posts: 192 Topics: 89
|
Posted: Mon Jun 13, 2005 4:33 am Post subject: |
|
|
Thanks a lot.
nadh |
|
Back to top |
|
|
|
|