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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Does anyone know of a way to interc 2

Status
Not open for further replies.

razalas

Programmer
Apr 23, 2002
237
US
Does anyone know of a way to intercept/change the date returned by the DATE functions in RM/Cobol? I don't see anything like it in the runtime config.

Am modifying a large number of programs that contain date dependent code (i.e. after a given date, certain features become active/inactive), and would like to test without having to rewrite the date logic or put in a bunch of code just for the purposes of testing and then have to take it back out again.

We are running Unix and have thought about just changing the system date, but that raises other issues. Any help would be appreciated,

Thanks, "Code what you mean,
and mean what you code"

Razalas
 
Hi,
If you run the program with the -d option (debug) you can use the m (modify) command to change the values of a field at any breakpoint in the program.
 
That'll work! [thumbsup2]

Thank you, "Code what you mean,
and mean what you code"

Razalas
 

I have also setup code like this to accept the date passed in as a paramater (linkage section). Just set up the code to test for a date passed in and use that rather then the system date.

if linkage-date greater than spaces
move linkage-date to work-date
else
use system-date
end-if.

This could even be left in the prodcution version and used in special case if you need to re-run for a past date.
 
If you are running RM/COBOL version 6.61 (or later) the following compiler configuration option may be of use.

COMPILER-OPTIONS ALLOW-DATE-TIME-OVERRIDE=YES

Compiling your programs with this option and then use the RM_Y2K environment variable to set the desired date and time.

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

The time and date will advance normally from the initial value for the life of the runtime. Note this will only work for future dates. See chapter 10 of the RM/COBOL User's Guide for more information.

-Rob
 
Rob,

Thank you very much! That was exactly the type of information I was looking for. I felt strongly that some feature of this type must have been implemented for Y2K. We have recently upgraded our production servers to v. 7.10.00, but unfortunately the development server won't be upgraded for awhile yet (still running 6.09.04). So for now I am running with the -D[ebug] switch and trapping the ACCEPT ... FROM DATE statements. "Code what you mean,
and mean what you code"

Razalas
 
Kkit,

Thanks for the suggestion. I generally try to provide for run-time overrides when I code, too. Unfortunately, this is a case of maintenance to an existing system. If it were just a couple of programs, I might consider adding the type of code you suggest, but it doesn't seem practical at this point in the applications life cycle. "Code what you mean,
and mean what you code"

Razalas
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top