Monday, November 06, 2006

Review topic: COBOL, PERFORM issues; leap year

I have found notes online that maintain that PERFORM UNTIL is equivalent to PERFORM WITH TEST BEFORE. This has always been the "common sense" undertanding of the UNTIL clause.

Murach, Structured Cobol, 2000, documents PERFORM UNTIL TEST AFTER on p. 197.

CALL statements default to "BY REFERENCE" but "BY VALUE" is used to call subprograms in other languages like C and C++ (usually on Unix systems). It is important when calling by value to make all the lenghts of the fields match, or you can get memory exceptions (S0C4 on the mainframe).

Here is a reference

I found a reference to the issue on IBM mainframes here.

2000 was a leap year, Reference:

Therefore, code to compute a leap year like this should work thru 2099:
DIVIDE MYYEAR BY 4 GIVING MYNUMBER REMAINDER MYLEAP
(all the MY--- are numeric)

However, sometimes, as in actuarial calculations about present value or life expectancy (as in insurance companies) we do have to worry about the year 2100, so you would need to test for centuries (other than 2000) that are not leap years because of the precise length of time the revolution of the earth around the sun takes. In 2100, we could have a "mini Y2K" problem.

No comments: