Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

adding to system date

Status
Not open for further replies.

judd328

Programmer
Feb 22, 2008
6
0
0
US
i need to add 6 months to the system date to do a test. i need to add to the whole date and not just the month so the year will roll over
 
We can help you. Send me an email to t.morrison at the obvious domain, or register for the Liant web forum and ask your question there.

Tom Morrison
 
What have you tried so far and where in your code are you stuck ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
this is what i have coded
01 ws-date.
05 ws-year pic 99.
05 ws-month pic 99.
05 ws-day pic 99.
01 test-date.
05 test-year pic 99.
05 test-month pic 99.
05 test-day pic 99.

accept ws-date from date
move ws-date to test-date

if ws-date is < 7
add 6 to test-date
end-if

evaluate ws-month
when 7
move 1 to test-month
add 1 to test-year
when 8
move 2
add 1

until i hit the 12 month
but when i compile the test-date is still 02.
 
What is the following supposed to do ?
if ws-date is < 7
add 6 to test-date
end-if

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
add 6 months to the current date
edit it is suposed to be test-month
 
Watch your variables in terms of which ones you are using.
Also notice patterns that you are seeing. This is really the kind of problem that is best thought out on pencil and paper beforehand. Clue: What you have shown has indicated that you haven't thought out one other problem.

Code:
if ws-month is < 7
   add 6 to test-month
else
   add 1 to test-year
   compute test-month = ws-month - 6
end-if.
 
You could use the ALLOW-DATE-TIME-OVERRIDE compiler configuration in conjunction with the RM_Y2K environment variable. See Chapter 10 of the RM/COBOL User's Guide for more information.


ALLOW-DATE-TIME-OVERRIDE. This keyword assists in testing for Year
2000 (Y2K) and other date/time problems by allowing parts of an application to
be tested without changing the actual date and time on the computer. An initial
date and time can be set prior to starting the RM/COBOL runtime system. The
value of ALLOW-DATE-TIME-OVERRIDE is set to YES, and the value of the
RM_Y2K environment variable is set with the desired date and time using the
following format:

RM_Y2K=YYYY,MM,DD,hh,mm,ss

Robert Heady
Liant Software Corp.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top