COBOL programming tools from NORCOM

     Products     Prices and Purchasing     Support     News     Partnerships     Home   Contact Us   Downloads

 

 

Norcom Date Routines Functions

The Norcom Date Routines include nearly 70(!) COBOL subroutines that perform a variety of useful date computations.

The routines are provided as COBOL source code.  The Date Routines are written in ANSI standard COBOL and will work with most COBOL compilers, including mainframe compilers.

The code is clean, readable, efficient, and profusely commented.

The manual is extremely easy to use. The documentation of the routines is clear and concise. We also discuss the origin and rules of the Gregorian calendar, including the rules governing leap years and leap centuries.

Each category includes routines that handle both six digit (MMDDYY and YYMMDD; century not included) and eight digit (MMDDCCYY and CCYYMMDD; century included) date formats. Here's what they do:

Get System Date

Acquires complete date from your system. (You may have to modify this routine for your specific platform and/or compiler.)

Select/Retrieve System-wide Rule

Selects or retrieves the default assumption used by the Date Routines for determining the century of a 6 digit date. You may override this default on individual calls to the Date Routines. The default is a windowing technique that works for dates that are plus-or-minus 49 years.

Determine Century of a 6 Digit Date

Converts a 6 digit date (which doesn't include the century) to an 8 digit date (which does).  This is, of course, limited to the limitations of the Rule (see above).

Date Validity Tests

Determines whether a date is valid. Yes, Virginia, we test for leap years (and leap centuries, too).

Gregorian to Julian Dates

Converts Gregorian dates (which is the MMDDYY norm that we're used to) to Julian dates (day-of-the-year YYDDD).

Julian to Gregorian Dates

Converts Julian dates to Gregorian dates.

Gregorian to Centurial Dates

Converts Gregorian dates to day-of-the-century. This form is extremely useful for figuring relationships between dates that aren't in the same year.

Centurial to Gregorian Dates

Converts day-of-the-century to Gregorian dates.

Compute Age In Years

Figures age in years, given a date of birth and the effective date. If the century isn't provided for the birthdate, we convert it using a Past assumption, thus handling ages up to 99 years if you're using the six-digit routine.  The eight-digit routine works correctly for any range within the limits of the package (99,999 days, which is a shade over 273 years).

Compare Two Dates

Compares the relationship between two dates; whether one is before, after, or the same as another date.

Test Date Within a Period

Tests whether a date lies within a specified period. Is the insurance policy in force, etc.

Compute Days Between Two Dates

Figures the number of days between two dates.

Calculate Date That Is x Days From a Known Date

What is the date 1,000 days from today? This routine will tell you. It works for both future and past dates.

Find Date, Given Month, Year & Desired Day

These routines find the date of "the second Monday in October, 1995" or "the fifteenth workday in May, 1952."

Day Name, Given a Date

Tells you which day of the week a date is; Monday, Tuesday, etc.

Month Name, Given a Date

Simple table lookup routine that yields the month name.

Leap Year & Leap Century Test

These routines tell you whether a given year is a leap year, and whether a given century is a leap century (yes, there is such a thing).

Insert or Delete Slashes

Format dates by inserting or removing separator characters (usually a slash but you can specify any character you want).

Random Number Generators

You're right, these have nothing to do with dates, but they're occasionally quite useful.

 



 

 

 

 

 

 

 

 



 


© 2000-2019 Norcom, all rights reserved 

Contact Norcom