My Date Utility Programs
This library is a combined collection of code from various sources that I have just merged into usefull programs in the attempt to get any date information I need easily.
I had a lot of programs doing their own date routines, some needing julian dates, some gregorian; and finally I needed to know what day of the week a date was... (wikipedia has some examples of how to work that out) and I decided I was not replicating that between programs; so have merged everything into one library that returns everything about a date that I could use; and I am changing all my programs to use this library instead of doing it themselves.
These utility programs are designed to be called from other assembler programs, not to be run directly. To make it easy to use there are only two user macros. One to define/map the data area and the other to work out what module needs to be called for you.
Note: this copy is generally more up-to-date than the github version as enhancements and bugfixes are applied here first.
General Use
It is designed to be simple to use. All the key programs are easily accessable via a simple macro call to UDATEMAC to request the function to be preformed, the macro will determine what program is to be called based on the request. The only other thing you need is a data are (dsect or inline) mapped by UDATEVAR to address the returned valued by field name.
Functions available
The programs used by UDATEMAC provided in this library will return text displayable values describing a date and time for the following request types
- return the current date and time; calculated using either a TIME DEC or STCK method as you choose. If using the STCK method you can chose whether the timezone offset is added or UTC time is returned
- you can provide a supplied date and time to be used (in either TIME DEC or STCK format) to obtain information on past or future dates
- You can request the last IPL date and time information is returned
There are macros that may be used inline where calling a program may be overkill to
- test if a YYYY value is a leap year
- determine the day of week a date falls on
All the programs currently in this library (with the exception of sched002 which has a totally different purpose) will all always return the following date information as character fields in a mapped DSECT for easy reference (see the UDATEVAR macro used to map the data area).
- The year (CCYY)
- The julian day (less the year bit already available above, so DDD)
- The current month and day (MMDD)
- The current time (HHMMSSht)
- The current day number (0=sunday thru 6=saturday)
- The day name, 'SUN' to 'SAT'.
The supplied dataset member TESTALL shows how to request each of the available standard UDATEnnn functions using the supplied macros. Additional test jobs are provided for macro-only and scheduler module testing; I may merge them into testall later.
Additional non-core Functionality added for scheduling
Obviously if there is a date library, the best way to show that it is usable is by writing a scheduler; stable eneough that it is the job scheduler I now use on my system :-).
-
Added SCHED001 (scheduling utility) to obtain the standard
data fields for a future date (ie: next sunday, next 13th,
exact date in future etc).
This can be considered a "core" program as I have forced it to fit into the UDATEMAC macro (bypassing version checking) for ease of use; but is was created as a scheduling function.
One warning is that it will always return a valid date even if you provide a bad one, ie: if you provide December 33rd 2015 the data fields returned will correctly return January 2nd 2016 - Added SCHED002 (scheduling utility) to return the number of hsecs between the current time and a provided future time if the future time is within the next 24hr window
- Added MDSCHED1 (member SCHEDTST) which is a full function scheduler that can, based on time/day/date scheduling of course, submit JCL job members to be run and issue console commands from command members. Stable enough that I use this now.
Download Location
If interested download the current datetime library.
This utility library will grow over time as I find more functions I need, for example I may one day handle 'TIME BIN' format, and maybe even take a passed text date and return STCK or TIME values; but I don't need them yet :-).
So keep an eye on this page.