Operating System - OpenVMS
Showing results for 
Search instead for 
Did you mean: 

Increment a year

New Member

Increment a year

Hi everyone,

I apologize if this is not the right form for this question.

My company got a maintenance contract for a VAX Basic program. I have no experience with this.

One of the changes I need to make is to change how the end date is calculated. Currently the end date is Dec 31 of the current year. I need to change that so that the end date is the same as the start date plus a year. So Dec 8 2010 start date and a Dec 8 2011 End Date.

How would I do something like this?

Thanks in advance.
Honored Contributor

Re: Increment a year

> My company got a maintenance contract for a
> VAX Basic program.


> I have no experience with this.

Perhaps those congratulations were premature.

> [...]
> How would I do something like this?

Ask the fellow who negotiated the contract?

Hire someone who has some related experience?

Did you really expect to get any useful
advice from people (who aren't getting paid
to do your job for you and, perhaps more
important) who can't see any of the existing
Trusted Contributor

Re: Increment a year

If it is VAX Basic, then it is pretty old. Start here: http://h71000.www7.hp.com/doc/basic.html

Personally, I have not used Basic since the '60s, and I don't recall there being dates in it. I do recall Beginner's All-purpose Symbolic Instruction Code.

Perhaps your program gets the date from Basic. Perhaps it gets it from VMS. Perhaps there is some other way. We have no way of knowing how your program does it. You are going to have to read the code.

Have fun.
Respected Contributor

Re: Increment a year

The basic question (pun intended) here is what assistance you really need. Are you asking how to code the problem in Basic or are you asking how to create the end date itself?

If the former, then post a snippet of the code that creates the end date now, and we can probably modify it.

If you are not familiar with Basic at all, perhaps someone should revisit the contract. To paraphrase Bob G in other notes: There are those of us here that provide consulting services for situations like this. Many of the posters here are consultants too.

Please update this and let us know, in detail, what you need.

Honored Contributor

Re: Increment a year

This comment has nothing to do with VAX Basic, but more with the specification.

Why wouldn't the end date be Dec 7th in your example? Otherwise you will be adding 1 day each year.

How are you going to handle Feb 29th.

it depends
Trusted Contributor

Re: Increment a year

Take a look at:


There are a bunch of lib$xxx functions which change the format of a date/time representation back-and-forth (string, 64-bit internal VMS, array of integers).

There's one to get the format in a structure with year/month/day represented in integers. Increment the year and call the suitable lib$xxx function to get it back to the format you need in your BASIC code.

Don't forget the handling of leap years (the fun part).

Honored Contributor

Re: Increment a year


Welcome to the HP ITRC OpenVMS Forum.

There is no single "correct" way to calculate the date one year hence. The precise method required depends upon the manner in which the date information is stored within the program.

There are also questions of definition. Is one year 365 days? Or is it the corresponding date (e.g., December 31) one year hence? There is a difference: leap years.

That said, the most common interpretation that I have seen in one year hence, same date. To avoid performing a separate leap year calculation, I would recommend breaking the TOY (time of year) into its component parts (using SYS$BINTIM and SYS$NUMTIM system services); incrementing the year; and then re-integrating the numeric time components back to an appropriate form. The preceding presumes that the expiration date has been stored in the standard OpenVMS time format.

Having provided technical backstop to several Y2K projects, I can assure you that there are a great number of ways to store dates, and the first and most important step is to determine how the date is currently being stored (and in what formats and locations; there may very well be more than one).

@Dan: Thank you for the reference. Indeed, the forum is best (and most appropriately) used as a communal mind, to ease research and assist memory. Using the forum for "crowd sourcing" code writing would be inappropriate. Specific modifications to proprietary code are appropriately a consulting matter outside of this forum.

- Bob Gezelter
New Member

Re: Increment a year

newYear% = INTEGER(SEG$(curDate$, 1%,4%))
newYear% = newYear% + 1

Sorry to waste your time with such a easy question.