Date logic generator6044219Abstract A utility with which a programmer can generate or alter computer code for a calendaring function, and test the code prior to compilation. Entering the program in edit mode, the programmer locates a portion of the program where code for a calendaring function is to be generated or altered, and invokes the date logic generator. The date logic generator provides an initial window with a choice of calendaring functions, and upon selecting a calendaring function, a parameters window displaying a number of first-level parameters for that function is provided. Depending on the specification of the values of the first-level parameters, sub-windows with second-level parameters may be provided. And, in general, depending on the specification of the values of the n-level parameters, (n+1)-level parameters may be provided in sub-windows. The parameters provided at any instant are only those which have already been specified or those that require specification. When the programmer believes the calendaring function is correctly chosen and its parameter values correctly specified, the operation of the function may be tested by a testing utility without requiring compilation of the computer code. Data for the calendaring function is entered in a testing utility sub-window, and the programmer can compare the testing utility output with an expected output. If the testing utility output and the expected output differ the programmer can modify the function or the function parameter values as appropriate. Further runs of the testing utility and modifications of the parameters of the calendaring function can be performed as needed. Claims What is claimed is: Description BACKGROUND OF THE INVENTION
______________________________________
DAYS BETWEEN DATE +/- N Days
______________________________________
FROM-DATE
Mar 15, 1994
FROM-DATE Mar 15, 1994
TO-DATE Mar 18, 1994
DIREC/DISPL +3
DIREC/DISPL
+3 TO-DATE Mar 18, 1994
FROM-DATE
Mar 18, 1994
FROM-DATE Mar 18, 1994
TO-DATE Mar 15, 1994
DIREC/DISPL -3
DIREC/DISPL
-3 TO-DATE Mar 15, 1994
______________________________________
FIG. 3 is a reference list of the parameters which may be routed through the conversational area 115. The parameters include business parameters, input parameters, and output parameters. Although all parameters include the prefix "TRC-CONVR-" in the preferred embodiment, this prefix is omitted in the following discussion for ease of presentation. Each row of the business, input and output parameters sections of FIG. 3 contains a parameter name, and may also contain the term "PIC" followed by the character type and length for the parameter; the term "VALUE", followed by a preset default value for the parameter; and/or a comment. Alphanumeric characters (including standard special characters such as hyphens, commas, etc.) are represented by an "X", and numeric characters (the numerals 0 through 9) are represented by a "9". The length of the character string for the parameter is the number in parentheses following the character type. For instance, "X(02)" represents an alphanumeric character string of length two, and "9(3)" indicates a numeric character string of length three. The business parameters are global settings that are in effect for every invocation of the system. The system administrator will assign initial values to these parameters to serve the needs of most of the company. Therefore, the user can probably leave these parameters untouched. However, if a user has any special requirements, he or she may change the value of any business parameter at any time. The business parameter HOLIDAY-TBL specifies the holiday table that the user would like to reference. The preferred embodiment of the present invention provides ten holiday tables, though a program with more holiday tables is within the scope of the invention. The system administrator can inform users which tables contain which holidays. The parameter FISCYR-START specifies the first month of the fiscal year, and its permitted values range from 01 through 12. The system uses this parameter when it performs a function related to the endpoints of a fiscal year or quarter. For example, FISCYR-START is used in the determination of answers to the questions "What is the beginning of the next fiscal quarter?" or "What was the end of the previous fiscal year?". If the company's fiscal year coincides with the calendar year, then this parameter is left at the default value of 01. The parameter FISCMO-START specifies the first day of the fiscal month, and its value can range from 01 through 28. The system uses this value when it performs a function related to the endpoints of the fiscal year, quarter or month. For example, FISCMO-START is used in the determination of answers to the queries "What is the beginning of the current fiscal month?" or "What was the end of the previous fiscal quarter?". If the company's fiscal month coincides with the calendar month, then this parameter is left at the default value of 01. The parameter END-PNTS-DEF specifies which of the date end-points the system will consider when it performs date calculations. There are four possible values for this parameter: B=Both FROM-DATE and TO-DATE N=Neither FROM-DATE or TO-DATE F=FROM-DATE only T=TO-DATE only The use of "T" to yield "common sense" answers is highly recommended. It should be noted that this parameter is used explicitly in the series 100, series 200 (except 207), series 600, and series 700 functions. This parameter is set implicitly to "T" for the function 207, and is set implicitly to "B" for the 800 series. These series of functions are described below. If the user uses the values "B" or "N", and specifies dates that are equal, or a direction/displacement of zero, then the user may receive an error message. This error message will say that the user has attempted a restricted operation. Consider a request to calculate the number of days between Jan. 14, 1995 and Jan. 14, 1995 with neither end point to be included. The solution to such a problem is undefined so the system restricts such operations, rather than assigning an arbitrary answer such as zero. It is important to understand the manner in which the processing day definition and END-PNTS-DEF work together. Let us suppose that the user wants to know the number of processing days from Sep. 06, 1993 to Sep. 09, 1993. Let us further suppose that Monday, Sep. 06, 1993 is a holiday, and that the user does not want to consider it a processing day. Under these circumstances the importance of specifying whether the end points are to be included or excluded is highlighted. If the end points parameter is set to "T" then the answer is 3 since the range of dates includes 07, 08, and 09, and all of these days qualify. However, if the end points parameter is set to "F" then the answer is 2, since the range of dates includes 06, 07, and 08, but 06 does not qualify because it is not a processing day. The parameter DOW-STRING allows the user to define the numerical values that correspond to each day of the week. In the preferred embodiment, position 1 corresponds to Sunday and position 7 corresponds to Saturday. For each day of the week any numerical value is accepted, although repeat values are not allowed. Three common standards are shown below: The preferred embodiment 1,2,3,4,5,6,7 IBM CICS 0,1,2,3,4,5,6 ANSI (and IBM COBOL II) 7,1,2,3,4,5,6 The parameter PROC-DAY-DEF is composed of 7 fields--one for each day of the week. In the preferred embodiment, position number 1 corresponds to Sunday, and position number 7 corresponds to Saturday. For each day, the user specifies one of the values "A", "N", "E", or "I". Each value specifies a different rule regarding the inclusion or exclusion of holidays. Their meanings are as follows:
______________________________________
A = Always (Always a processing day)
N = Never (Never a processing day)
E = Exclude (A processing day only if not a Holiday)
I = Include (A processing day, only if a Holiday)
______________________________________
As an example, the value `NEEEEEN` means the weekends and weekday holidays are not processing days. The parameter CENTURY-BREAK allows the user to tell the system how to assign a value to the century when the supplied date does not explicitly contain the century. The parameter has the following syntax: "AA/BB; CC". The variable CC specifies a breakpoint, and the values AA and BB specifies contiguous centuries. If the value of the year of century is less than CC then the century is assigned the value AA, and otherwise the century is assigned the value BB. For example, the value "19/20; 50" translates to: If the year is between 00 and 49, then the century is assigned the value 20, otherwise the year is between 50 and 99, and the century is assigned the value 19. The parameter FROM-DATE-MASK allows the user to define the format of the FROM-DATE. Specification of the mask determines the arrangement of various pieces of date information, such as year, month and day. There are five date elements: "CC" for the century, "YY" for the year of century, "MM" for the Gregorian month, "DD" for the Gregorian day, and "DDD" for the Julian day. In the mask the user must specify a filler character "-", that would correspond to leading zeroes for a numeric Cobol "MOVE", or correspond to trailing spaces for an alphanumeric Cobol "MOVE", when using less than the full eight digits. There are 52 different Gregorian and Julian formats. Consider the following examples where CENTURY-BREAK has the default value "19/20; 50":
______________________________________
MASK VALUE DATE
______________________________________
YYDDD
22005 January 5, 2022
YYDDD--- 58040--- February 9, 1958
YYMMDD
760410 April 10, 1976
YYMMDD-- 490228-- February 28, 2049
CCYYMMDD 19930605 June 05, 1993
DDCCYYMM 05199306 June 05, 1993
______________________________________
The parameters TO-DATE-MASK, OUT1-DATE-MASK, OUT2-DATE-MASK, and OUT3-DATE-MASK define the formats of TO-DATE, OUT1-DATE, OUT2-DATE, and OUT3-DATE, respectively. Their use is completely analogous to that of FROM-DATE-MASK described above. The input parameters shown in FIG. 3 under the heading INPUT-PARAMETERS are parameters that a user passes to the system. The four-digit parameter FUNCTION-CODE specifies the task that the user wants the system to perform. This parameter contains two components, FUNCTION-TYPE and FUNCTION-NUMBER. FUNCTION-TYPE is specified by a one character code where "U" signifies a utility function, "C" signifies a calendar day function, and "P" signifies a processing day function. The FUNCTION-NUMBER is specified by a three-digit numerical value. Particular functions are described in detail below. The parameter FROM-DATE serves two purposes. If a function requires only one date, then that date goes into a FROM-DATE field. If a function requires both a FROM-DATE and a TO-DATE, then obviously, the "from date" goes into the FROM-DATE field. The format of the FROM-DATE is defined by the FROM-DATE-MASK as discussed above. If the user enters the literal "CURRDATE" into the FROM-DATE field, then the current date will be substituted into the FROM-DATE field. This is termed an "implicit" use of the current date. The current date may be determined by reading the system clock, a file containing the current date, or an entry in a relational database. The FROM-DATE is actually stored in two storage registers, FROM-DATE-9 and FORM-DATE-X. FROM-DATE-9 contains the FROM-DATE in a numeric field of eight characters, and FROM-DATE-X contains the FROM-DATE in an alphanumeric field of eight characters. When the FROM-DATE is initialized in either one of the registers, the system of the present invention automatically initializes the other register as well. Storing the FROM-DATE in these two formats provides additional flexibility and transportability to the system. The parameter TO-DATE specifies the TO-DATE for functions that require such a date. The format of the TO-DATE is defined by the TO-DATE-MASK and the value of the parameter is stored in a storage register. Again, if the user enters the literal "CURRDATE" into the TO-DATE field, then the current date will be substituted into the field. Again, this is termed an "implicit" use of the current date. The parameter IN-NUMERIC-PARM specifies a DIRECTION and DISPLACEMENT in number of days. The DIRECTION is specified by a leading sign character, S, and the displacement is specified by the subsequent eight digits. The sign is separate from the direction, rather than encoded into the direction, thereby allowing IN-NUMERIC-PARM to be transported to other programs and computers. If a user wants to know the date that is 4 days later than Mar. 15, 1997, then he or she would put a value of +4 into IN-NUMERIC-PARM. If the user wants to know the date that is 6 days before Mar. 15, 1997, then he or she would put a value of -6 into IN-NUMERIC-PARM. For function 207 (see below), the value of IN-NUMERIC-PARM must be nonzero. For odd functions in the range 801 through 836 (see below), the value of IN-NUMERIC-PARM must be greater than zero, while for even functions in the range 801 through 836 (see below), the value of IN-NUMERIC-PARM must be less than zero. The parameter IN-ALPHA-PARM specifies the days of the week that the user wants to consider when working with function 207 (see below) and the functions 801-836 (see below). The parameter has seven fields corresponding in order to the days of the week Sunday through Saturday. The user specifies "Y" for "yes" or "N" for "no", for each day of the week to instruct the system which days of the week to include in its calculations. The output parameters contain values that the user receives from the system. The output parameters include return codes, date data, and numeric data. The output parameter RETURN-CODE contains information regarding the completion of the task. It contains a three-digit return number, RETURN-NUM, and an eighty-character return text, RETURN-TEXT. RETURN-NUM specifies whether the return is a good return (000) or a bad return (001-999). The calling program 110 interfaced to the calendaring program of the present invention 120 should test the value of the return number every time the system is invoked. If the return number specifies a bad return, then the other output areas have no meaning. The 80 character RETURN-TEXT elaborates on the meaning of the value of RETURN-NUM. If RETURN-NUM has a value of is 000, then RETURN-TEXT will say "GOOD RETURN." However, if the RETURN-NUM is 001-999, then the RETURN-TEXT will contain a descriptive message. If the function that the user has specified results in the calculation of a date, then that date will be found in four different date fields. The first of the output date fields is STDOUT-DATE. It is an eight character field representing the system standard format of "CCYYMMDD". STDOUT-DATE is provided for the user automatically. The parameters OUT1-DATE, OUT2-DATE and OUT3-DATE are the second, third and fourth output date areas. Their formats are specified by OUT1-DATE-MASK, OUT2-DATE-MASK and OUT3-DATE-MASK, as discussed above. The parameter OUT-NUMERIC-PARM serves two purposes. Most of the time, OUT-NUMERIC-PARM specifies the answer to such questions as "How many calendar days are there from Aug. 15, 1997 to Aug. 23, 1997?" or "How many calendar days are there from Sep. 19, 1994 to Sep. 13, 1994?" In the first example the answer is +8 and in the second example the answer is -6. For inquiries of this type, the answer always specifies an eight-digit displacement and a direction by providing a plus or minus sign before an integer. In other cases OUT-NUMERIC-PARM denotes answers to specific questions posed by utility functions U002 through U007, as listed in the below:
______________________________________
FUNC TASK OUT-NUMERIC-PARM
______________________________________
U002 Valid Date? 0 - NO; 1 - YES
U003 Leap Year? 0 - NO; 1 - YES
U004 Holiday? 0 - NO; 1 - YES
005 Processing Day?
0 - NO; 1 - YES
U006 Day of Week See DOW-STRING
U007 Absolute Days
00000001 - 03652056
______________________________________
The system provides the user with four classes of functions: utility functions, basic functions, extended functions, and advanced functions. Any date calculation utilizing these functions is based on day counting according to the flow charts shown in FIGS. 5c and 5d, and a leap-year determination method according to the flow chart shown in FIG. 4a. As shown in FIG. 4a, the leap year status of a year is determined by first calculating in Mod(3200) unit 305 the remainder when the year is divided by 3200. If the remainder is zero 310 it is then concluded that the year is not a leap year 315 and this status is stored in a leap year status register (not shown). Otherwise, the nonzero remainder 320 is passed to a Mod(400) unit 325 where the remainder of the output of the Mod(3200) unit 305 when divided by 400 is determined. If the remainder is zero 330 it is then concluded that the year is a leap year 335, and this status is stored in the leap year status register. Otherwise 340, the nonzero remainder is passed to Mod(100) unit 345 where its remainder when divided by 100 is determined. If the remainder is zero 350 then it is concluded that the year is not a leap year 315, and this status is stored in the leap year status register. Otherwise 355, the nonzero remainder is passed to the Mod(4) unit 360 where its remainder when divided by 4 is determined. If the remainder is zero 365 it is concluded that the year is a leap year 335, and this status is stored in the leap year status register. Otherwise 370, there is a nonzero remainder, it is concluded that the year is not a leap year 315, and this status is stored in the leap year status register. It should be noted that the system described by the flow chart of FIG. 4a may be extended by the inclusion of other division units above the Mod(3200) unit 305 to generate a higher degree of accuracy. Alternatively, reduced accuracy may be produced by excluding the Mod(3200) unit 305, or the Mod(3200) unit 305 and the Mod(400) unit 325, etc. To calculate the absolute days corresponding to a given date, the leap year rules described above and depicted in FIG. 4a are applied as shown in the flow chart of FIG. 4b. In calculating the absolute days corresponding to a date located in a year and having a Julian day value, the days in all the years prior to the year in which the date lies must be totaled, and then the Julian day value of the present year is added. Therefore the year 500 referred to in FIG. 4b is the year prior to the year containing the date. The absolute days is determined by first passing the year value 500 to a unit 510 which adds 1,168,775 to an absolute days register (not shown) for each multiple of 3200 in the year 500. Then, the value of the year 500 modulo(3200) is calculated 515, and passed to a unit 520 which adds 146,097 to the absolute days register for each multiple of 400 in the value produced by the modulo(3200) unit 515. The value generated by the modulo(3200) unit 515 is then passed to a unit 525 which calculates the modulo(400) value and passes this value to a unit 530 which adds 36,524 to the absolute days register for each multiple of 100 in this value. The value generated by the modulo(400) unit 525 is then passed to a unit 535 which calculates the modulo(100) value, and passes this value to a unit 540 which adds 1461 to the absolute days register for each multiple of 4 is the value generated by the modulo(100) unit 535. The value generated by the modulo(100) unit 535 is then passed to a modulo(4) unit 545. The value of the year 500 modulo(4) is passed to a unit 550 which adds 365 to the absolute days register for each year left, and in a final unit 555 the Julian day of the date is added to the absolute days register. For example, consider the date Jan. 15, 1993. Since 1993-1=(4.times.400)+(3.times.100)+(23.times.4), the absolute days corresponding to Jan. 15, 1993 is (4.times.146,097)+(3.times.36,524)+(23.times.1461)+15=727,578. The day of week of a given date is then determined by passing the absolute days value to a unit 560 which calculates the absolute days value modulo(7). For instance, the day of week of Jan. 15, 1993 is Friday since the modulo(7) value of 727,578 is 5 and Jan. 1, 0001 was a Monday. The system of the present invention permits the calling program 110 to reference ten different holiday tables. However, it should be understood that the present invention is not limited to having ten holiday tables, and a greater or lesser number of holiday tables is considered within the scope of the present invention. The system administrator defines all ten holiday tables, possibly under the advisement of a business analyst associated with the shop. Some or all of the holiday tables may be empty. Possible holiday tables may be based on federal holidays, state holidays, bank holidays, stock market holidays (domestic and/or foreign), or holidays of foreign countries. FIG. 5a shows the process required to define a holiday table. To create tables containing holidays is a two-pass operation through a holiday table generator TRCHLGEN 610. First, the system administrator enters two dates 600: January 1 of the earliest year and December 31 of the latest year for which the holiday listings are to be created. The preprocessing program TRCHLGEN 610 creates three print files 625, namely an error report 630, a control report 631 and a calendar listing 632, to provide the system administrator with hard-copy results. (If TRCHLGEN 610 does not execute successfully at this point, then the job control language may have to be modified to tailor it to the host.) The error report 630, the control report 631, and the calendar listings 632 each contain 80 characters per line, to facilitate viewing from the remote terminal or monitor 130. These files may be stored for future reference. The error report 630 informs the system administrator of errors such as the entry of duplicate dates. The control report 631 informs the system administrator of the final status and statistics, i.e. the total number entries (in this case two) and the number of good and bad entries. The calendar listings 632 is provided if there were no errors in the input of the holiday information 600. The calendar listings 632 contains dates ranging from the earlier date to the later date. TRCHLGEN also creates a COBOL copybook 620 that contains the holiday information; in this case the two input dates are marked as holidays. The calendar listings 632 are then used as a hardcopy "turnaround" document to identify and mark all of the holidays of interest for a second pass through TRCHLGEN 610. The holiday table information 600 is input to the system by first inputting a holiday table number with the format "TBL-ID=xx", where xx is a number in the range 01 through 10. This is followed by a sequence of "card-like" images, each containing one holiday date in columns 1-8 in the CCYYMMDD format. A card-like image with an asterisk in column one, will be treated as a comment. Preprocessing program TRCHLGEN 610 checks each holiday date for errors and sorts all the holidays in each table in chronological order to detect duplicates. TRCHLGEN 610 creates a COBOL copybook 620 that contains the holiday information. The name of the copybook 620 is TRCHLTxx, where xx is a number in the range 01 through 10. The preprocessing program TRCHLGEN 610 again creates the three print files 625, namely an error report 630, a control report 631 and a calendar listing 632, to provide the system administrator with hard-copy results. The error report 630 informs the system administrator of errors such as the entry of duplicate holidays. The control report 631 informs the system administrator of the final status and statistics, i.e. the total number entries and the number of good and bad entries, of the program. The calendar listings 632 is provided if there were no errors in the input of the holiday information 600. The copybook file 620 contains detailed and summary information relating to the holidays specified by the system administrator. The holidays of the copybook 620 may be transferred for storage 635 to the main component TRCENGIN 640 of the calendaring program 120 in ascending sequence in the absolute days format, possibly with the use of a COPY statement or an INCLUDE statement. Alternatively, the holidays may be held in a file or an ancillary subprogram which may be accessed 635 by the main component TRCENGIN 640. Precalculation of the absolute dates provides maximum efficiency during the execution of TRCENGIN 640. As shown in the table of FIG. 5b, if TRCHLGEN 610 executes successfully and the input 600 is good, then there will not be an error report 630 because there were no errors. A control report 631 with a message saying "GOOD INPUT; CALENDARS-YES, COPYBOOK-YES," and a calendar listing that ranges from January 1st of the earliest year through December 31st of the latest year with all chosen holidays marked, will be generated. Furthermore, the copybook 620 will contain all of the holiday information required by TRCENGIN 640. However, if the input 600 is bad, then calendar listings 632 and a copybook 620 will not be generated, as is shown in the table of FIG. 5b. The control report will have a message saying "BAD INPUT; CALENDARS-NO, COPYBOOK-NO," and the error report 630 will be a detailed report showing all of the errors that were detected. If all ten holiday tables are not needed, then empty tables must be created so that the total number of holiday tables is ten. To create an empty table, the program TRCHLGEN 610 is executed with only the TBL-ID=xx card 600 as input. As shown in the table of FIG. 5b, there will then be no error report 630 because there was no holiday input, the control report 631 will have a message saying "NO INPUT; CALENDARS-NO, COPYBOOK-YES," and the copybook 620 will have an empty holiday table. All calendar-day calculations of a number of days between two dates are calculated by subtraction of absolute day values. If an END-PNTS-DEF of "T" or "F" is specified the number of days is simply equal to the difference between the absolute days values. However, if an END-PNTS-DEF of "N" is specified the absolute value of the difference is decreased by unity, and if an END-PNTS-DEF of "B" is specified the absolute value of the difference is increased by unity. All processing-day calculations of a number of days between two dates are based on the day counting method shown in the flow chart of FIG. 5c. As shown in FIG. 5c, initially 400 a day counter register is set to a value of zero and the FROM-DATE is initialized according to the value provided by the date calculation call. Then a decision module 410 determines whether the value of END-PNTS-DEF is a "B" or an "F". If the answer is "NO" 414 the FROM-DATE is advanced towards the TO-DATE 416 since the initial FROM-DATE is not to be counted as an endpoint. Otherwise 412, the value of END-PNTS-DEF is "B" or "F" and the FROM-DATE is to be counted as an endpoint. Then a decision module 420 tests whether the TO-DATE has been reached. If the answer is "YES" 422 then the process flow is directed to a decision module 426 which tests whether the value of END-PNTS-DEF is a "B" or a "T". If the answer is "NO" 427 END-PNTS-DEF does not have a value of "B" or "T", then the computation is complete and the day counter register holds the desired answer. If the answer is "YES" 429 END-PNTS-DEF has a value of "B" or "T", or "NO" 422 the TO-DATE has not been reached, then the process flow is directed to a module 434 where the day of week (DOW) for the present FROM-DATE is identified. Decision module 435 then tests whether the PROC-DAY-DEF for that DOW has the value "A". If so 436 then the number in the day counter register is incremented by the tally routine 437 and the FROM-DATE is advanced towards the TO-DATE at the Advance Towards TO-DATE module 415. If the PROC-DAY-DEF for that DOW is not "A" 438 then the process flow is directed to a decision module 440 which determines if the PROC-DAY-DEF for that DOW is an "N". If the answer is "YES" 442 then the FROM-DATE is advanced towards the TO-DATE at the Advance Towards TO-DATE module 415. If the answer is "NO" 444 then the process flow is directed to another decision module 450 which determines if the PROC-DAY-DEF for that DOW is an "E". If the answer is "YES" 452 then another decision module 454 determines if the FROM-DATE is a holiday by consulting the invoked holiday table. If the answer is "YES" 456 then the FROM-DATE is advanced towards the TO-DATE at the Advance towards TO-DATE module 415. However, if the answer is "NO" 458 then a tally routine 459 increments the day counter before advancing the FROM-DATE. If it is determined that the PROC-DAY-DEF is not "E" 453 then the process flow is directed to another decision module 460 which determines if the PROC-DAY-DEF for that DOW is an "I". If the answer is "YES" 462 then a decision module 464 determines if the FROM-DATE is a holiday by consulting the holiday table. If the answer is "NO" 468 then the FROM-DATE is advanced towards the TO-DATE at the Advance Towards TO-DATE module 415. However, if the answer is "YES" 465 then a tally routine 466 increments the day counter before advancing the FROM-DATE at the Advance Towards TO-DATE module 415. If it is determined at decision module 460 that the PROC-DAY-DEF for that DOW is not "I" 463 then an error message is generated 470, since every DOW must be assigned one of the values "A", "N", "E", or "I" and according to the path of the process flow the DOW does not have one of these values. After the FROM-DATE is advanced towards the TO-DATE at the Advance Towards TO-DATE module 415 the process flow is directed back to the decision module 420 that determines if the TO-DATE has been reached, and the process continues as before. The process terminates only when the stop 428 is reached. All calendar-day calculations of a TO-DATE a target number of days from a FROM-DATE are determined by addition or subtraction of absolute day values. The absolute value of the target number is termed the "displacement" and the sign of the target number is termed the "direction". If the direction is positive the displacement is added to the absolute days value of the TO-DATE, and if the direction is negative the displacement is subtracted from the absolute days value of the TO-DATE. If the END-PNTS-DEF is "N" the TO-DATE is incremented by unity in the direction of the target number, and if the END-PNTS-DEF is "B" the TO-DATE is incremented by unity in the opposite direction of the target number. All processing-day calculations of a TO-DATE a target number of days from a FROM-DATE are based on the day counting method shown in the flow chart of FIG. 5d. As shown in FIG. 5d, initially 500 a day counter register is set to a value of zero and the TO-DATE is initialized to the value of the FROM-DATE. Then a decision module 510 determines whether the value of END-PNTS-DEF is a "B" or an "F". If the answer is "NO" 514 the TO-DATE is advanced since the initial FROM-DATE is not to be counted as an endpoint. Otherwise, the answer is "YES" 512 the value of END-PNTS-DEF is "B" or "F", and the FROM-DATE is to be counted as an endpoint, and the flow proceeds to a decision module 520. Then a decision module 520 tests whether the target number stored in a target number register (not shown) has been reached by the counter number stored in the counter number register. If the answer is "NO" 522 then the process flow is directed to a module 534 which identifies the day of week (DOW) of the FROM-DATE. However, if the answer is "YES" 524 the target number has been reached then a decision module 526 tests whether the value of END-PNTS-DEF is a "B" or a "T". If the answer is "YES" 527 then the process flow stops 528, the computation is complete, and the TO-DATE register holds the desired answer. If the answer is "NO" 529 the END-PNTS-DEF does not has a value of "B" or "T", then the process flow is directed to a decision module 580 which determines whether the target number has been exceeded. If the answer is "YES" 581 the target number has been exceeded, then the process ends 528 and the desired answer is stored in the TO-DATE register. Otherwise, the answer is "NO" 582 the target number has not been exceeded, and the process flow is directed to the module 534 which identifies of DOW of the FROM-DATE by the method discussed above and depicted in the flow-chart of FIG. 4b. Decision module 535 then tests whether the PROC-DAY-DEF for that DOW has the value "A". If the answer is "YES" 536 then the number in the day counter register is incremented by the tally routine 537 and the TO-DATE is advanced at the Advance Towards TO-DATE module 515. If the PROC-DAY-DEF for that DOW is not "A" 538 then the process flow is directed to a decision module 540 which determines if the PROC-DAY-DEF for that DOW is an "N". If the answer is "YES" 542 then the TO-DATE is advanced at the Advance TO-DATE module 515. If the answer is "NO" 544 then the process flow is directed to another decision module 550 which determines if the PROC-DAY-DEF for that DOW is an "E". If the answer is "YES" 552 then another decision module 554 determines if the TO-DATE is a holiday by consulting the invoked holiday table. If the answer is "YES" 556 then the TO-DATE is advanced at the Advance TO-DATE module 515. However, if the answer is "NO" 558 then a tally routine 559 increments the day counter before advancing the TO-DATE. If it is determined that the PROC-DAY-DEF is not "E" 553 then the process flow is directed to another decision module 560 which determines if the PROC-DAY-DEF for that DOW is an "I". If the answer is "YES" 562 then a decision module 564 determines if the TO-DATE is a holiday by consulting the holiday table. If the answer is "NO" 568 then the TO-DATE is advanced at the Advance TO-DATE module 515. However, if the answer is "YES" 565 then a tally routine 566 increments the day counter before advancing the TO-DATE at the Advance TO-DATE module 515. If it is determined at decision module 560 that the PROC-DAY-DEF for that DOW is not "I" 563 then an error message is generated 570, since every DOW must be assigned one of the values "A", "N", "E", or "I" and according to the path of the process flow the DOW does not have one of these values. After the TO-DATE is advanced at the Advance TO-DATE module 515 the process flow is directed back to the decision module 520 that determines if the target number has been reached by the counter number, and the process continues as before. The process terminates only when the stop 528 is reached. There are nine different utility functions, each specified by a one-character FUNCTION-TYPE, followed by a three digit FUNCTION-NUMBER. The FUNCTION-TYPE for all utility functions is the letter "U". The FUNCTION-NUMBER for utility functions ranges between 001 and 009. Below is a list of the utility function numbers and the corresponding names of the functions: 001 CURRENT DATE 002 VALID DATE? 003 LEAP YEAR? 004 HOLIDAY? 005 PROCESSING DAY? 006 IDENTIFY DAY OF WEEK 007 DATE CONVERSION TO ABSOLUTE DAYS 008 ABSOLUTE DAYS CONVERSION TO DATE 009 REFORMAT DATE The CURRENT DATE function (U001) provides the current date. Let us assume that the current date is May 17, 1993. If, as shown in example 1 of FIG. 6, the OUT1-DATE-MASK specifies the mask CCYYMMDD, and the FUNCTION-CODE, U001, requests the current date. After the call the current date is placed in OUT1-DATE in the format specified by the mask. This is termed an "explicit" use of the current date. The current date may be determined by reading the system clock, a file containing the current date, or an entry in a relational database. Example 2 of FIG. 6 is the same as Example 1, except that in Example 2 the OUT1-DATE-MASK specifies the mask CCYYDDMM, rather than CCYYMMDD. Therefore, in Example 2 the same date, May 17, 1993, is shown in a different format. The function VALIDATE DATE, U002, determines whether a specified date is valid. Invalid dates include dates with nonnumeric characters and numbers which do not correspond to a date. If the date is valid, then the value returned in OUT-NUMERIC-PARM is 1, otherwise the value is 0. As shown in Example 1 of FIG. 7, FROM-DATE-MASK specifies the mask CCYYMMDD. The FUNCTION-CODE requests validation of the FROM-DATE, Feb. 17, 1993, provided in the CCYYMMDD format. That date is valid, so OUT-NUMERIC-PARM has a value of 1. Example 2 of FIG. 7, is the same as above, except that in this example the FROM-DATE is not valid since it contains the letter "W" and is not numeric. Therefore, OUT-NUMERIC-PARM has the value 0. Notice that the system has set the value of RETURN-NUM to 014 which has been defined to designate the error message "Bad From-Date". The function LEAP YEAR determines if the specified date lies within a leap year. If it does, then the value returned in OUT-NUMERIC-PARM is 1, otherwise the value is 0. LEAP YEAR has a function code of U003. As shown in Example 1 of FIG. 8, a call to LEAP YEAR with the FROM-DATE-MASK of CCYYMMDD and the FROM-DATE of 20001225 (Dec. 25, 2000) returns OUT-NUMERIC-PARM with a value of 1 since the year 2000 is a leap year. In Example 2 the FROM-DATE is Dec. 25, 1995 and OUT-NUMERIC-PARM is 0 since 1995 is not a leap year. The function HOLIDAY determines if the specified date is a holiday. If it is, then the value returned by OUT-NUMERIC-PARM is 1, otherwise the value is 0. HOLIDAY has a function code of U004. As shown in Example 1 of FIG. 9, the HOLIDAY-TBL field specifies Holiday Table 04, and the FROM-DATE-MASK specifies the format CCYYMMDD. The FUNCTION-CODE, U004, requests holiday status, and in this case the FROM-DATE is Jul. 4, 1996 (the Fourth of July) and is in Holiday Table 04, so OUT-NUMERIC-PARM is 1. Example 2 of FIG. 9 is the same as Example 1, except that the FROM-DATE, Feb. 3, 1994, happens not to be in Holiday Table 04. Therefore OUT-NUMERIC-PARM is 0. The function PROCESSING DAY determines if the specified date is a processing day. If it is, then the value of OUT-NUMERIC-PARM is 1, otherwise the value is 0. PROCESSING DAY has a FUNCTION-CODE of U005. Example 1 of FIG. 10 shows that the HOLIDAY-TBL specifies table number 05, and the FROM-DATE-MASK specifies the format CCYYMMDD. Feb. 17, 1992 happens to be in Holiday Table 05, and is a Monday. The PROC-DAY-DEF, "AAAAAAA", indicates that each day of the week is to be considered a processing day. The FUNCTION-CODE U005 requests the processing day status of the FROM-DATE. Therefore, the system sets OUT-NUMERIC-PARM to the value 1. Example 2 of FIG. 10 is the same as above, except that the PROC-DAY-DEF, "NEEEEEN", means that Monday is specified as a processing day when it does not fall on a holiday. Therefore the system does not consider the FROM-DATE a processing day, and sets OUT-NUMERIC-PARM to the value 0. The function DAY OF WEEK identifies the day of the week that corresponds to the specified date. The number value corresponding to the day of the week is determined by the value assigned to DOW-STRING, as discussed above. DAY OF WEEK has the function code U006. As shown in Example 1 of FIG. 11 the FROM-DATE-MASK specifies the format CCYYMMDD, and the DOW-STRING specifies the string of numerals "1234567". The FUNCTION-CODE, U006, requests the day of the week, and the FROM-DATE, Feb. 17, 1992 falls on a Monday, so the system sets OUT-NUMERIC-PARM to the value 2. Example 2 of FIG. 11 differs from Example 1 in that the DOW-STRING specifies the string "0123456". Since the FROM-DATE, May 19, 1993, is a Wednesday the system sets OUT-NUMERIC-PARM to the value 3. The function DATE.fwdarw.ABSOLUTE DAYS (U007) converts the specified date into the absolute day count, i.e., the number of days since Jan. 01, 0001. As shown in Example 1 of FIG. 12, the FROM-DATE-MASK specifies CCYYMMDD, and the FUNCTION-CODE, U007, requests the absolute day count. The FROM-DATE, Jan. 01, 0001, has been defined as day 1, so the system sets OUT-NUMERIC-PARM to the value 1. In Example 2 the FROM-DATE, Jan. 1, 2005, corresponds to day 731947 so OUT-NUMERIC-PARM is set to this value. The function ABSOLUTE DAYS.fwdarw.DATE (U008) converts the specified absolute day count into the corresponding calendar date. As shown in Example 1 of FIG. 13, the OUT1-DATE-MASK specifies the format CCYYMMDD, and the FUNCTION-CODE, U008, requests a conversion from absolute days to a calendar date. The IN-NUMERIC-PARM specifies day count 1, so the system sets OUT1-DATE to Jan. 01, 0001. In Example 2, the IN-NUMERIC-PARM specifies day count 731947, and the system sets OUT1-DATE to 20050101, i.e., Jan. 1, 2005. The function REFORMAT DATE (U009) converts the specified FROM-DATE into the STDOUT, OUT1, OUT2, and OUT3 dates specified by the corresponding date masks as described above. As shown in Example 1 of FIG. 14, the system converts the FROM-DATE of 19920301 having the format CCYYMMDD specified by the FROM-DATE-MASK to the various output dates, whose formats are specified by the masks CCYYDDMM, YYMMDD-, and -CCYYDDD. Since 1992 is a leap year, as can be confirmed by use of the flowchart of FIG. 4a, March 1st corresponds to Julian day number 61 and the values of OUT1-DATE, OUT2-DATE and OUT3-DATE are therefore 19920103, 920301, and 01992061, respectively. In Example 2 the same date masks are used, but the year is 1993 rather than 1992. The year 1993 is not a leap year so March 1st corresponds to Julian day number 60 and the values of OUT1-DATE, OUT2-DATE, and OUT3-DATE are 19930103, 930301, and 01993060, respectively. There are four "basic" functions. These basic functions perform the rudimentary calculations "DAYS BETWEEN" and "DATE+/-N DAYS". Each basic function is specified by a one-character FUNCTION-TYPE, followed by a three-digit FUNCTION-NUMBER. The FUNCTION-TYPE is either "C" or "P", where "C" means that the system considers all calendar days, and "P" means that the system considers only processing days. The FUNCTION-NUMBER for the basic functions is either 101 or 102, where 101 signifies "DAYS BETWEEN" and 102 signifies "DATE +/-N DAYS." The basic functions are also called the "100 series functions." The function DAYS BETWEEN (C/P 101) counts the number of days from the FROM-DATE to the TO-DATE. If the FROM-DATE is earlier than the TO-DATE, the answer is positive. If the FROM-DATE is later than the TO-DATE, the answer is negative. In Example 1 of FIG. 15a, the function type "C" indicates that every calendar day qualifies. Since the parameter END-PNTS-DEF is assigned the value "T", the FROM-DATE corresponds to day count 0. According to the logic of FIG. 5c, the table below shows how the dates from the FROM-DATE of Sep. 3, 1993 to the TO-DATE of Sep. 7, 1993 are counted to provide the OUT-NUMERIC-PARM value of +4:
______________________________________
DATE QUALIFICATION
COUNT
______________________________________
19930903 N/A +0
19930904 YES +1
19930905 YES +2
19930906 YES +3
19930907 YES +4
______________________________________
In Example 2 of FIG. 15b the function type is "P", so only processing days are counted. The processing day definition, PROC-DAY-DEF, is "NEEEEEN" so weekends are not counted, and weekdays are counted when not holidays. Sep. 6, 1993 happens to be in Holiday Table 06, and is a Monday so the table below shows how the dates are counted to provide the PARM value of +1:
______________________________________
DATE QUALIFICATION
COUNT
______________________________________
19930903 N/A 0
19930904 NO (Saturday)
0
19930905 NO (Sunday) 0
19930906 NO (Holiday) 0
19930907 YES +1
______________________________________
Examples 3 and 4 of FIG. 15b, are similar to Examples 1 and 2 of FIG. 15a, except that the FROM-DATE and the TO-DATE have been reversed. The table below shows how the days are counted in Example 3 to provide the OUT-NUMERIC-PARM value of -4:
______________________________________
DATE QUALIFICATION
COUNT
______________________________________
19930907 N/A 0
19930906 YES -1
19930905 YES -2
19930904 YES -3
19930903 YES -4
______________________________________
The table shows how the days are counted in Example 4 to provide the OUT-NUMERIC-PARM value of -1:
______________________________________
DATE QUALIFICATION
COUNT
______________________________________
19930907 N/A 0
19930906 NO (Holiday) 0
19930905 NO (Sunday) 0
19930904 NO (Saturday)
0
19930903 YES -1
______________________________________
The function DATE +/-N DAYS (C/P 102) calculates the date that is N days later or earlier, respectively, than the specified date. Example 1 of FIG. 16a shows the calculation of the date that is +4 days from the FROM-DATE of Sep. 3, 1993. According to the end point definition, END-PNTS-DEF, of `T` the FROM-DATE corresponds to a day count of 0. Because the FUNCTION-TYPE is `C`, every day qualifies and the days are counted as shown in the table below according to the logic of FIG. 5c to provide the OUT1-DATE value of 19930907, i.e. Sep. 7, 1993:
______________________________________
DATE QUALIFICATION
COUNT
______________________________________
19930903 N/A 0
19930904 YES +1
19930905 YES +2
19930906 YES +3
19930907 YES +4
______________________________________
However, in Example 2 of FIG. 16a the FUNCTION-TYPE is a `P` and since Sep. 6, 1993 happens to be in Holiday Table 06 the days are counted as shown in the table below to provide the OUT1-DATE value of 19930910, i.e. Sep. 10, 1993:
______________________________________
DATE QUALIFICATION
COUNT
______________________________________
19930903 N/A 0
19930904 NO (Saturday)
0
19930905 NO (Sunday) 0
19930906 NO (Holiday) 0
19930907 YES +1
19930908 YES +2
19930909 YES +3
19930910 YES +4
______________________________________
Examples 3 and 4 of FIG. 16b, are similar to Examples 1 and 2 of FIG. 16a, except that IN-NUMERIC-PARM is negative (toward the past), rather than positive (toward the future). In Example 3 the days are counted as shown below to provide the OUT1-DATE of 19930903:
______________________________________
DATE QUALIFICATION
COUNT
______________________________________
19930907 N/A 0
19930906 YES -1
19930905 YES -2
19930904 YES -3
19930903 YES -4
______________________________________
In Example 4 the days are counted as shown below to provide the OUT1-DATE of 19930903:
______________________________________
DATE QUALIFICATION
COUNT
______________________________________
19930910 N/A 0
19930909 YES -1
19930908 YES -2
19930907 YES -3
19930906 NO (Holiday) -3
19930905 NO (Sunday) -3
19930904 NO (Saturday)
-3
19930903 YES -4
______________________________________
There are fourteen extended functions. They answer common questions such as "What is the next day?" or "What date is three days before the end of the month?". Each extended function is specified by a one-character FUNCTION-TYPE, followed by a three-digit FUNCTION-NUMBER. The FUNCTION-TYPE for all extended functions is either "C" or "P", where "C" means that the system considers all calendar days, and "P" means that the system considers only processing days. The FUNCTION-NUMBER for extended functions ranges from 201 to 207 so these functions are referred to as the "200 series." The FUNCTION-NUMBERS and names are listed below: 201 NEXT DAY 202 PREVIOUS DAY 203 DAYS SINCE BEGINNING OF MONTH 204 DATE UNTIL END OF MONTH 205 BEGINNING OF MONTH+/-N DAYS 206 END OF MONTH+/-N DAYS 207 NTH DOW OCCURRENCE FORWARD/BACKWARD The function NEXT DAY (C/P 201) provides the date that is one day later than the date provided by the user. Example 1of FIG. 17 shows a call to C201 to determine the calendar date that is one day later than the FROM-DATE of Feb. 12, 1993 (19930212 in the format CCYYMMDD). Since END-PNTS-DEF is assigned a value of T, the FROM-DATE corresponds to day count 0. Every day qualifies and the days are counted as shown below to provide the OUT1-DATE of Feb. 13, 1993:
______________________________________
DATE QUALIFICATION
COUNT
______________________________________
19930212 N/A +0
19930213 YES +1
______________________________________
In Example 2 of FIG. 17 the FUNCTION-TYPE is "P" so only processing days are counted. It happens that Sep. 6, 1993 is in holiday table 07 and the days are counted as shown below to provide the OUT1-DATE of Feb. 16, 1993:
______________________________________
DATE QUALIFICATION
COUNT
______________________________________
19930212 N/A 0
19930213 NO (Saturday)
0
19930214 NO (Sunday) 0
19930215 NO (Holiday) 0
19930216 YES +1
______________________________________
The function PREVIOUS DAY (C/P 202) finds the date that is one day earlier than the date provided by the user. Example 1 of FIG. 18 shows a call to C202 to find the calendar date that is one day earlier than Feb. 16, 1993 (19930216 in the format CCYYMMDD). According to the value of T assigned to END-PNTS-DEF, the FROM-DATE corresponds to a day count of 0. In Example 1, every day qualifies and the days are counted as shown in the table below to provide the OUT1-DATE of Feb. 15, 1993:
______________________________________
DATE QUALIFICATION
COUNT
______________________________________
19930216 N/A -0
19930215 YES -1
______________________________________
Since Feb. 15, 1993 happens to be in holiday table 07, the call to P202 in Example 2 is counted as shown below to provide the OUT1-DATE of Feb. 12, 1993:
______________________________________
DATE QUALIFICATION
COUNT
______________________________________
19930216 N/A 0
19930215 NO (Holiday) 0
19930214 NO (Sunday) 0
19930213 NO (Saturday)
0
19930212 YES -1
______________________________________
The function DAYS SINCE THE BEGINNING OF THE MONTH (C/P 203) provides the number of days from the date specified by the user to the beginning of the month. Example 1 in FIG. 19 shows the calculation of the number of days from Jul. 06, 1994 (19940706 in the format CCYYMMDD) back to the beginning of the month. According to the value of "T" assigned to END-PNTS-DEF, the FROM-DATE corresponds to a day count of zero. Because TYPE is "C", every day qualifies and the days are counted as shown in the table to the logic of FIG. 5c to provide an OUT-NUMERIC-PARM value of -5:
______________________________________
DATE QUALIFICATION
COUNT
______________________________________
19940706 N/A -0
19940705 YES -1
19940704 YES -2
19940703 YES -3
19940702 YES -4
19940701 YES -5
______________________________________
In Example 2 of FIG. 19 the FUNCTION-TYPE is "P" so only processing days are counted. The processing days definition `NEEEEEN` means that Saturdays and Sundays are never processing days and weekends are processing days only when not holidays. It happens that Jul. 4, 1994 is in holiday table 05 and the days are counted as shown in the table below to provide an OUT-NUMERIC-PARM value of -2:
______________________________________
DATE QUALIFICATION
COUNT
______________________________________
19940706 N/A 0
19940705 YES -1
19940704 NO (Holiday) -1
19940703 NO (Sunday) -1
19940702 NO (Saturday)
-1
19940701 YES -2
______________________________________
The function DAYS UNTIL THE END OF THE MONTH (C/P 204) provides the number of days from the date specified by the user to the end of the month containing that date. Example 1 of FIG. 20 shows a call to this function for the calculation of the number of days from Dec. 23, 1992 (19921223 in the format CCYYMMDD) forward to the end of the month. According to the value of "T" assigned to END-PNTS-DEF, the FROM-DATE corresponds to a day count of zero. In Example 1 every day qualifies since the FUNCTION-TYPE is "C", and the days are counted as shown in the table below to provide the OUT-NUMERIC-PARM value of
______________________________________
DATE QUALIFICATION
COUNT
______________________________________
19921223 N/A +0
19921224 YES +1
19921225 YES +2
19921226 YES +3
19921227 YES +4
19921228 YES +5
19921229 YES +6
19921230 YES +7
19921231 YES +8
______________________________________
In Example 2 FIG. 20 the FUNCTION-TYPE is "P" so only processing days are counted. It happens that Dec. 25, 1993, Christmas Day, is in holiday table 08 so the days are counted as shown in the table below to provide the OUT-NUMERIC-PARM value of +5:
______________________________________
DATE QUALIFICATION
COUNT
______________________________________
19921223 N/A 0
19921224 YES +1
19921225 NO, (Holiday)
+1
19921226 NO, (Saturday)
+1
19921227 NO, (Sunday) +1
19921228 YES +2
19921229 YES +3
19921230 YES +4
19921231 YES +5
______________________________________
The function BEGINNING OF THE MONTH +/-N DAYS (C/P 205) provides the date that is N days before or after the beginning of the month specified by the input date. Example 1 of FIG. 21 shows a call to this function to determine the date that is 5 days after the beginning of the month containing Jul. 23, 1994. The FROM-DATE is now defined as the beginning of July, i.e. Jul. 01, 1994. Then, according to the value of "T" assigned to END-PNTS-DEF, the FROM-DATE corresponds to a day count of zero. In Example 1, every day qualifies since the FUNCTION-TYPE is "C" and the days are counted as shown in the table below to provide the OUT1-DATE 19940706:
______________________________________
DATE QUALIFICATION
COUNT
______________________________________
19940701 N/A 0
19940702 YES +1
19940703 YES +2
19940704 YES +3
19940705 YES +4
19940706 YES +5
______________________________________
In Example 2 the FUNCTION-TYPE is "P" so only processing days are counted. It happens that Jul. 4, 1994, the fourth of July, is listed in holiday table 05, so the days are counted as shown in the table below to provide the OUT1-DATE of 19940711:
______________________________________
DATE QUALIFICATION
COUNT
______________________________________
19940701 N/A 0
19940702 NO (Saturday)
0
19940703 NO (Sunday) 0
19940704 NO (Holiday) 0
19940705 YES +1
19940706 YES +2
19940707 YES +3
19940708 YES +4
19940709 NO (Saturday)
+4
19940710 NO (Sunday) +4
19940711 YES +5
______________________________________
The function END OF THE MONTH +/-N DAYS (C/P 206) provides the date that is N days before or after the end of the month in which the FROM-DATE is located. Example 1 of FIG. 22 shows a call to this function to find the calendar date that is 4 days prior to the end of the month containing Dec. 05, 1992. The FROM-DATE is defined as the end of the month, i.e., Dec. 31, 1992. Then, according to the value of "T" assigned to END-PNTS-DEF, the FROM-DATE corresponds to day count zero. In Example 1, the FUNCTION-TYPE is "C" so every day qualifies and the days are counted as shown in the table below to provide OUT1-DATE of Dec. 27, 1992:
______________________________________
DATE QUALIFICATION
COUNT
______________________________________
19921231 N/A 0
19921230 YES -1
19921229 YES -2
19921228 YES -3
19921227 YES -4
______________________________________
Example 2 is the same as Example 2 except that the FROM-DATE is Dec. 18, 1992 and the function type is "P" so only processing days are calculated. The FROM-DATE is again Dec. 31, 1992, and the days are counted as shown below to provide the OUT1-DATE of Dec. 24, 1992:
______________________________________
DATE QUALIFICATION
COUNT
______________________________________
19921231 N/A 0
19921230 YES -1
19921229 YES -2
19921228 YES -3
19921227 NO, (Sunday) -3
19921226 NO, (Saturday)
-3
19921225 NO, (Holiday)
-3
19921224 YES -4
______________________________________
The function Nth DOW OCCURRENCE FORWARD/BACKWARD (C/P 207) provides the date that is the Nth of a specified day of week forward or backward from a reference date. In this function an END-PNTS-DEF value of T is implicitly utilized. Example 1 of FIG. 23 shows a call to this function to find the calendar date that is the second Friday prior to the date that is specified as the FROM-DATE of Dec. 28, 1992. IN-ALPHA-PARM has the value `NNNNNYN`, thereby specifying Friday as the day to be counted, and the second occurrence is specified by the IN-NUMERIC-PARM value of -2. Since the FUNCTION-TYPE is "C", Fridays are counted as shown in the table below to provide the OUT1-DATE of Dec. 18, 1992:
______________________________________
DATE QUALIFICATION
COUNT
______________________________________
19921228 N/A -0
19921225 YES -1
19921218 YES -2
______________________________________
In Example 2 is the same as Example 1 except that the FUNCTION-TYPE is "P" so only processing days are counted. The days are counted in the table below to provide the OUT1-DATE Dec. 11, 1992:
______________________________________
DATE QUALIFICATION
COUNT
______________________________________
19921228 N/A 0
19921225 NO (Holiday) 0
19921218 YES -1
19921211 YES -2
______________________________________
Additionally, there are 288 advanced functions. These functions address questions such as "What date is three days prior to the end of the previous fiscal quarter?" The FUNCTION-TYPE for advanced functions is either "C" or "P", where "C" means that the system considers all calendar days, and "P" means that the system considers only processing days. The FUNCTION-NUMBER for advanced functions has a format "Fxx", where F ranges from 5 through 8, and the last two digits, "xx", range from 01 to 36. The F values of 5, 6, 7 and 8 correspond to functions termed the 500, 600, 700 and 800 series, respectively. The F digit identifies the type of calculation, and the last two digits of the FUNCTION-NUMBER identify the time period of interest. FIGS. 24a-d graphically depict the calculations of the 500, 600, 700, and 800 series, respectively. In these figures `START` indicates the starting date; a curved arrow labelled with a `1` indicates the determination of a second date at the beginning or end of a calendar or fiscal year, month or quarter; a curved arrow labelled with a `2` indicates the determination of a date that is a specified number of days from the origin of the arrow; a curved arrow labelled with a `3` indicates the determination of a date that is a specified number of a specified day of week from the origin of the arrow; and a straight arrow indicates the determination of the number of days from the origin of the arrow to the tip of the arrow. As shown in FIG. 24a, the 500 series functions identify a date which is the beginning or end of a fiscal or calendar year, month or quarter. The 500 series functions are termed "DATE IDENTIFICATION" functions. As shown in FIG. 24b, the 600 series identify a date which is a beginning or end of a calendar or fiscal year, month, or quarter, and determine the number of days to that date. The 600 series functions are termed "DAYS SINCE/UNTIL" functions. The 700 series identify a date which is a beginning or end of a calendar or fiscal year, month or quarter, and calculate a TO-DATE a specified number of days from to that date, as shown in FIG. 24c. The 700 series functions are termed "DATE RELATIVE TO" functions. The 800 series functions identify a date at the beginning or end of a calendar or fiscal year, month or quarter, and calculate the Nth occurrence of a specified day of week (DOW) from that date. The 800 series functions are therefore termed "Nth DOW WITHIN A PERIOD" functions. In the 800 series functions the END-PNTS-DEF value of "B" is implicitly utilized in counting the DOWs. The last two digits of the FUNCTION-NUMBER identify the time period of interest. Below is a listing of the time periods corresponding to the numbers 1 through 36:
______________________________________
TIME-PERIOD FUNCTION-NUMBER
______________________________________
Calendar Year
Previous Beginning F01
Previous End F02
Current Beginning F03
Current End F04
Next Beginning F05
Next End F06
Fiscal Year
Previous Beginning F07
Previous End F08
Current Beginning F09
Current End F10
Next Beginning F11
Next End F12
Calendar Quarter
Previous Beginning F13
Previous End F14
Current Beginning F15
Current End F16
Next Beginning F17
Next End F18
Fiscal Quarter
Previous Beginning F19
Previous End F20
Current Beginning F21
Current End F22
Next Beginning F23
Next End F24
Calendar Month
Previous Beginning F25
Previous End F26
Current Beginning F27
Current End F28
Next Beginning F29
Next End F30
Fiscal Month
Previous Beginning F31
Previous End F32
Current Beginning F33
Current End F34
Next Beginning F35
Next End F36
______________________________________
The500 series DATE IDENTIFICATION functions provide a date of particular interest. As shown in Example C51 of FIG. 25a, the "C" of the FUNCTION-TYPE C519 specifies the identification of the calendar beginning of a period. The last two digits of the FUNCTION-NUMBER specifies that the time period is the previous fiscal quarter from the FROM-DATE. The FROM-DATE is specified to be the current date, which in this case we assume to be May 17, 1993. Since FISCYR-START has a value of 04, the fiscal year is defined as starting April 1st. Since the current date lies in the first fiscal quarter, the beginning of the previous fiscal quarter is therefore Jan. 01, 1993, and OUT1-DATE has a value of 19930101. Example P51 is the same as Example C51, except that the processing beginning of the previous fiscal quarter is requested. Since Friday, Jan. 01, 1993 happens to be a holiday in holiday table 08, and the processing day definition assigns Friday an "E", Jan. 01, 1993 is not considered a processing day. Therefore, a forward adjustment is performed by searching toward the future until a processing day is encountered. Saturday and Sunday are never processed according to the processing day definition, so the next processing day is Jan. 04, 1993, and the OUT1-DATE is assigned a value of 19930104. In Example C52 of FIG. 25b, the function code C504 calls for the identification of the calendar end of the calendar year containing the FROM-DATE of Nov. 29, 1993. The calendar end of 1993 is Dec. 31, 1993, so the value of OUT1-DATE is 19931231. Example P52 is the same as Example C52, except that the processing end of the calendar year containing Nov. 29, 1993 is requested. Since it happens that Dec. 31, 1993, New Years Eve, is a holiday according to holiday table 08 and it is a Friday, it is not considered a processing day since PROC-DAY-DEF assigns Fridays an "E" value. Therefore, a backward adjustment is performed by searching toward the past until a processing day is encountered. Dec. 30, 1993 qualifies, and this is the answer returned by OUT1-DATE. The 600 series DAYS SINCE/UNTIL functions provide a number that specifies the direction and displacement from the FROM-DATE to the specified date of interest. In Example C61 of FIG. 26a, the function C619 calls for a determination of the direction and displacement in calendar days from the current date to the calendar beginning of the previous fiscal quarter. Since the value 04 of FISCYR-START indicates that the fiscal year starts April 1st, the current date, which we assume to be May 17, 1993, lies in the first quarter. The beginning of the previous fiscal quarter is Jan. 01, 1993. Jan. 01, 1993 is therefore the effective TO-DATE and the system determines the direction and displacement in calendar days from May 17, 1993 to Jan. 01, 1993. The answer is -136 calendar days. Example P61 of FIG. 26a is the same as Example C61, except that the direction and displacement in processing days from the current date to the processing beginning of the previous fiscal quarter is requested. Since Jan. 01, 1993 is a holiday according to holiday table 08 and is a Friday, it is not considered a processing day according to the PROC-DAY-DEF assignment of an "E" to Fridays. Therefore a forward adjustment is performed by searching toward the future until a processing day is encountered. Saturday and Sunday are not processing days, so a processing day does not occur until Jan. 04, 1993. That date becomes the effective TO-DATE and the system determines the direction and displacement in processing days from May 17, 1993 to Jan. 04, 1993. The answer is -95 processing days. In Example C62 of FIG. 26b, the FUNCTION-CODE C604 calls for the identification of the direction and displacement in calendar days from Nov. 29, 1993 to the calendar end of the calendar year containing Nov. 29, 1993. The calendar end of 1993 is Dec. 31, 1993, which becomes the effective TO-DATE. The system then determines the direction and displacement in calendar days from Nov. 29, 1993 to Dec. 31, 1993. The answer is +32 calendar days. Example P62 of FIG. 26b is the same as Example C62, except that the direction and displacement in processing days from Nov. 29, 1993 to the processing end of the calendar year containing Nov. 29, 1993 is requested. Since Friday Dec. 31, 1993 happens to be in holiday table 08, it is not considered a processing day. Therefore, a backward adjustment is performed by searching toward the past until a processing day is encountered. Dec. 30, 1993 qualifies, so it becomes the effective TO-DATE. The system then determines the direction and displacement, in processing days, from Nov. 29, 1993 to Dec. 30, 1993. The answer is +22 processing days. The 700 series DATE RELATIVE TO functions provide a date that is determined by starting at a calendar date of particular interest, and advancing forward or backward a specified number of days. In Example C71 of FIG. 27a, the FUNCTION CODE C719 calls for the determination of the date that is +5 calendar days from the calendar beginning of the previous fiscal quarter. Since the fiscal year starts April 1st as indicated by the FISCYR-START value of 04, the current date which we assume to be May 17, 1993, lies in the first fiscal quarter. The beginning of the previous fiscal quarter is Jan. 01, 1993 so that date becomes the effective FROM-DATE. The system calculates the date +5 calendar days from the FROM-DATE, and the answer is Jan. 06, 1993. Example P71 of FIG. 27a is the same as the Example C71, except that the date requested is +5 processing days from the processing beginning of the previous fiscal quarter. Since Jan. 01, 1993 is a Friday and is a holiday according to holiday table 08, it is not considered a processing day. Therefore a forward adjustment is performed by searching toward the future until a processing day is encountered. Saturday and Sunday are never processed according to the PROC-DAY-DEF value of NEEEEEN, so a processing day does not occur until Jan. 04, 1993. The system then calculates the date that is +5 processing days from the new FROM-DATE of Jan. 04, 1993 and the answer is Jan. 11, 1993. In Example C72 of FIG. 27b, the FUNCTION-CODE C704 calls for the identification of the date that is -6 calendar days from the calendar end of the calendar year containing the FROM-DATE of Nov. 29, 1993. The calendar end of 1993, Dec. 31, 1993, becomes the effective FROM-DATE, and the system then calculates the date that is -6 calendar days from Dec. 31, 1993. The answer is Dec. 25, 1993. Example P72 is the same as Example C72, except that since the FUNCTION-TYPE is a P the date requested is -6 processing days from the processing end of the calendar year containing Nov. 29, 1993. Since Dec. 31, 1993 is a holiday and it's a Friday, it is not considered a processing day. Therefore, a backward adjustment is performed by searching toward the past until a processing day is encountered. Dec. 30, 1993 qualifies according holiday table 08, so it becomes the effective FROM-DATE. The system then calculates the date that is -6 processing days from the FROM-DATE yielding the answer Dec. 21, 1993. The series 800 Nth DOW OCCURRENCE WITHIN A PERIOD functions are executed in three stages: (1) the desired period beginning or end specified by the last two digits of the FUNCTION-NUMBER is determined relative to the FROM-DATE; (2) the system counts forward from the beginning of the period or backward from the end of the period the number of days specified by IN-NUMERIC-PARM, tallying only the days of week specified by PROC-DAY-DEF, END-PNTS-DEF, and IN-ALPHA-PARM; and (3) the system checks that the answer is still within the period specified in the first stage. In Example C81 of FIG. 28a, the FUNCTION-CODE C827 calls for the determination of a date relative to the calendar beginning of the current calendar month since the last two digits of the FUNCTION-NUMBER are 27, and the FUNCTION-TYPE is C. Since IN-NUMERIC-PARM is +4 and the value of IN-ALPHA-PARM is `NNNNNYN`, the requested date is the 4th calendar Friday after the calendar beginning of the calendar month containing the FROM-DATE of Dec. 15, 1992. The calendar beginning of the calendar month containing Dec. 15, 1992 is Dec. 01, 1992. The system counts forward 4 calendar Fridays until it reaches Dec. 25, 1992, which becomes the answer. Example P81 is the same as Example C81, except that since the FUNCTION-TYPE is P, the date that is the 4th processing Friday after they processing beginning of the calendar month containing Dec. 15, 1992 is requested. The analysis starts out, as before, with Dec. 01, 1992. However this time, when the system counts ahead 4 processing Fridays, it must skip Friday, Dec. 25, 1992 (Christmas) since it happens to be listed in holiday table 08, and therefore not a processing day. The actual answer, therefore lies in January, which results in an error message, because the desired answer is beyond the end of the specified period. Example C82 of FIG. 28b is the same as Example C81 of FIG. 28a except that the FUNCTION-CODE C828 calls for the determination of a date relative to the calendar end of the current calendar month, and the value of IN-NUMERIC-PARM is -4 rather than +4. Since IN-ALPHA-PARM is `NNNNNYN` and the FROM-DATE is Dec. 15, 1992, the requested date is the 4th calendar Friday prior to the calendar end of the calendar month containing Dec. 15, 1992. The calendar end of the calendar month containing Dec. 15, 1992 is Dec. 31, 1992. The system then counts backward four calendar Fridays until it reaches Dec. 04, 1992, which is therefore the answer. Example P82 of FIG. 28b is the same as Example C82, except that since the FUNCTION-CODE is P, the date requested is the 4th processing Friday prior to the processing end of the calendar month in which the FROM-DATE of Dec. 15, 1992 occurs. The analysis starts out, as before, with Dec. 31, 1992. However this time, when the system counts backwards 4 processing Fridays, it must again skip Friday, Dec. 25, 1992 because it is not a processing day. The answer, therefore lies in November. This results in an error message because the desired answer is earlier than the beginning of the specified period. 360-Day-Year Calendaring Functions The 360-day-year calendar was developed for financial calculations because of the simplicity of a year where each month has 30 days. For instance, the day-of-the-year which is 46% of a year past March 1 is easily determined by noting that 169.2 is 46% of 360, and since it is easily determined that 169 equals 5.times.30 plus 19, an increment of 169 days in a 360-day-year is an increment of five months and nineteen days. Therefore, August 20 is 46% of a year past March 1 according to a 360-day-year calculation. Also, many fractional year increments are equal to an integer number of months: one twelfth of a year is one month, one sixth of a year is two months, one fourth of a year is three months, one third of a year is four months, and one half of a year is sixth months. Although this type of simplification is not of as much use in the current age of microelectronics, many financial institutions still use 360-day-year methods for ongoing calculations which were started using a 360-day-year method. Also, 360-day-year methods are implemented in business or legal situations where such methods remain a standard. Generally, the prior art systems use an algebraic formula for conversion of Gregorian or Julian dates to 360-day-year dates and conversion of 360-day-year dates to Julian or Gregorian dates, but generate dates which do not actually exist or gaps between existing dates. For instance, a pseudocode implementation of an algorithm for conversion of a Gregorian date to a 360-day-year date is: If (GREGORIAN-DAY-OF-MONTH<30), Set 360-DAY=GREGORIAN-DAY-OF-MONTH, Else Set 360-DAY=30; Set 360-DAY=360-DAY+[30.times.(GREGORIAN-MONTH-1)]; For the year 1996, which is a leap year, this pseudocode generates the conversions from Gregorian dates to 360-day-year dates shown in Table 1 below.
TABLE 1
______________________________________
Gregorian Date
360-day-year Date
______________________________________
02/27/1996 1996/057
02/28/1996 1996/058
02/29/1996 1996/059
03/01/1996 1996/061
03/02/1996 1996/062
______________________________________
It should be noted that according to this conversion, in a leap year there is no 60th day-of-the-year of the 360-day-year. For the year 1994, which is not a leap year, this pseudocode generates the conversions from Gregorian dates to 360-day-year dates shown in Table 2 below.
TABLE 2
______________________________________
Gregorian Date
360-day-year Date
______________________________________
02/27/1994 1994/057
02/28/1994 1994/058
03/01/1994 1994/061
03/02/1994 1994/062
______________________________________
It should be noted that according to this conversion, in a non-leap year there is no 59th day-of-the-year and no 60th day-of-the-year of the 360-day-year. A pseudocode implementation of an algorithm for conversion of a Julian date to a 360-day-year date is: If JULIAN-YEAR is a leap year Set 360-DAY=Integer(JULIAN-DAY*360/366); If JULIAN-YEAR is not a leap year Set 360-DAY=Integer(JULIAN-DAY*360/365); where the function Integer outputs the largest integer less than or equal to the value of the argument. For the year 1996, which is a leap year, this pseudocode generates the conversions from Julian dates to 360-day-year dates shown in Table 3 below.
TABLE 3
______________________________________
Julian Date 360-day-year Date
______________________________________
057/1996 056/1996
058/1996 057/1996
059/1996 058/1996
060/1996 059/1996
061/1996 060/1996
062/1996 060/1996
063/1996 061/1996
______________________________________
It should be noted that according to this conversion, in a leap year there are two 60th days-of-the-year of the 360-day-year. For the year 1994, which is not a leap year, this pseudocode generates the conversions from Julian dates to 360-day-year dates shown in Table 4 below.
TABLE 4
______________________________________
Julian Date 360-day-year Date
______________________________________
057/1994 056/1994
058/1994 057/1994
059/1994 058/1994
060/1994 059/1994
061/1994 060/1994
062/1994 061/1994
063/1994 062/1994
______________________________________
A pseudocode implementation of an algorithm for conversion of a 360-day-year date to a Gregorian date is: Set GREGORIAN-MONTH=Integer(360-DAY/30) TEMP=GREGORIAN-MONTH.times.30; GREGORIAN-DAY-OF-MONTH=360-DAY-TEMP; Set GREGORIAN-MONTH=GREGORIAN-MONTH+1; If GREGORIAN-DAY-OF-MONTH=0 Then Set GREGORIAN-DAY-OF-MONTH=30 And Set GREGORIAN-MONTH=GREGORIAN-MONTH-1; Set GREGORIAN-YEAR=360-DAY-YEAR; where again the function Integer outputs the largest integer less than or equal to the value of the argument. For the year 1996, which is a leap year, this pseudocode generates the conversions from 360-day-year dates to Gregorian dates shown in Table 5 below.
TABLE 5
______________________________________
360-day-year Date
Gregorian Date
______________________________________
057/1996 2/27/1996
058/1996 2/28/1996
059/1996 2/29/1996
060/1996 2/30/1996
061/1996 3/01/1996
062/1996 3/02/1996
______________________________________
It should be noted that according to this conversion, February has thirty days. For the year 1994, which is not a leap year, this pseudocode generates the conversions from Gregorian dates to 360-day-year dates shown in Table 6 below.
TABLE 6
______________________________________
360-day-year Date
Gregorian Date
______________________________________
057/1994 2/27/1994
058/1994 2/28/1994
059/1994 2/29/1994
060/1994 2/30/1994
061/1994 3/01/1994
062/1994 3/02/1994
______________________________________
Again, according to this conversion February has thirty days. A pseudocode implementation of an algorithm for conversion of a 360-day-year date to a Julian date is: If 360-YEAR is a leap year Set JULIAN-DAY=Integer(360-DAY*366/360); If 360-YEAR is not a leap year Set JULIAN-DAY=Integer(360-DAY*365/360); where the function Integer outputs the largest integer less than or equal to the value of the argument. For the year 1996, which is a leap year, this pseudocode generates the conversions from 360-day-year dates to Julian dates shown in Table 7 below.
TABLE 7
______________________________________
360-day-year Date
Julian Date
______________________________________
057/1996 057/1996
058/1996 058/1996
059/1996 059/1996
060/1996 061/1996
061/1996 062/1996
062/1996 063/1996
______________________________________
It should be noted that according to this conversion, in a leap year there is no 60th day-of-the-year of the Julian year. For the year 1994, which is not a leap year, this pseudocode generates the conversions from 360-day-year dates to Julian dates shown in Table 8 below.
TABLE 8
______________________________________
360-day-year Date
Julian Date
______________________________________
057/1996 057/1996
058/1996 058/1996
059/1996 059/1996
060/1996 060/1996
061/1996 061/1996
062/1996 062/1996
______________________________________
These algebraic methods for conversions between calendars present some problems. For instance, converting the 60th day-of-the-year of the 360-day-year calendar during a leap year such as 1996 to the Gregorian calendar (see Table 5) produces the date Feb. 30, 1996. This date does not exist, and inadequate error screening would cause a system failure or a faulty calculation. Similarly, converting the 59th and 60th days-of-the-year of the 360-day-year calendar for 1994, a year which is not a leap year, to the Gregorian calendar (see Table 6) produces the dates Feb. 29, 1994 and Feb. 30, 1994. Neither of these dates exist, and again inadequate error screening would cause a system failure or a faulty calculation. It should also be noted that in a conversion from a Gregorian day-of-the-year to a 360-day-year day-of-the-year, the 60th day-of-the-year of the 360-day-year does not exist for leap years (see Table 1), and the 59th and 60th days-of-the-year of the 360-day-year do not exist for non-leap years (see Table 2). Since the Gregorian year has 365 days, it is to be expected that the mapping of Gregorian day-of-the-year to 360-day-year days-of-the-year is a many-to-one mapping, and every day-of-the-year of the 360-day-year should be used. Therefore, a mapping of Gregorian days-of-the-year to 360-day-year days-of-the-year which does not use all of the available days in the 360-day-year is clearly not optimal. Another problem with the algebraic conversion methods is that in converting an initial day-of-the-year from the Julian calendar to the 360-day-year calendar, and then back to the Julian calendar does not necessarily produce the initial day-of-the-year. For instance, the 58th and 63rd days-of-the-year of the Julian calendar of 1996, a year which is a leap year, are converted to the 57th and 61st days-of-the-year of the 360-day-year calendar of 1996 (see Table 3), respectively. However, converting the 57th and 61st days-of-the-year of the 360-day-year calendar of 1996 back to the Julian calendar produces the 57th and 62nd days-of-the-year (see Table 7), respectively. Similarly, the 58th and 63rd days-of-the-year of the Julian calendar of 1994, a year which is not a leap year, are converted to the 57th and 62st days-of-the-year of the 360-day-year calendar of 1994 (see Table 3), respectively. However, converting the 57th and 62st days-of-the-year of the 360-day-year calendar of 1994 to the Julian calendar produces the 57th and 62nd days-of-the-year (see Table 7), respectively. Also, the same sort of problem results in converting a day-of-the-year from the 360-day-year calendar to the Julian calendar, and then back to the 360-day-year calendar. The system 700 of the present invention for conversion of a Gregorian day-of-the-year to a 360-day-year day-of-the-year is shown in FIG. 29A. (Conversions between the 360-day-year and the Julian calendar are implemented by combining a conversion between the 360-day-year calendar and the Gregorian calendar according to the present invention, with an additional conversion between the Gregorian and Julian calendars according to methods well-known in the art.) The system 700 includes a plurality of storage registers 705, 715, 725, 730, 740, 750, and 770 (shown as rectangular blocks), a plurality of processing units 703, 710, 720, 735, 745, 755 and 765 (shown as oval blocks), and a look-up table 760 (shown as a rectangular block). In the preferred embodiment of the present invention the processing units 703, 710, 720, 735, 745, 755 and 765 are implemented as COBOL computer code. Alternatively, the processing units 703, 710, 720, 735, 745, 755 and 765 may be dedicated hardwired processors. A Search Table unit 755 requires data from a Leap Year Flag Access Register 725, a Month/Day Character Register 740, and a Found Flag Register 750, so these registers 725, 740 and 750 must be loaded with the appropriate values prior to the search performed by the Search Table unit 755. Therefore, the flow chains beginning with a Load Year unit 703, a Binary Gregorian Date Register 730, and a Set Found Flag unit 745 must be completed prior to the operation of the Search Table unit 755. The Search Table unit 755 outputs data to the 360-Day-Year Day-of-the-year Register 770, and back to the Found Flag Register 750. Since the Search Complete unit 765 utilizes the flag value in the Found Flag Register 750, the Search Complete unit 765 operates after the Search Table unit 755 has terminated. (For clarity, the control apparatus for initiating the flow chains is not shown in FIG. 29A.) To set the flag in the Leap Year Flag Access Register 725 a year is loaded by a Load Year unit 703 into a Year Register 705. This year in the Year Register 705 is accessed by a Test For Leap Year unit 710 which sets a flag in a Leap Year Flag Buffer Register 715 if the year is indeed a leap year. In the preferred embodiment of the present invention, it is determined whether a year is a leap year by calculating the remainders R(4), R(100), R(400) and R(3200) when the year is divided by 4, 100, 400, and 3200, respectively. If R(4) is not zero, the year is not a leap year. If the R(4) is zero, but R(100) is not, the year is a leap year. If R(100) is zero, but R(400) is not, the year is not a leap year. If R(400) is zero, but R(3200) is not, the year is a leap year. And, if R(3200) is zero, the year is not a leap year. The flag in the Leap Year Flag Buffer Register 715 is then copied by a Copy unit 720 to a Leap Year Flag Access Register 725. The Copy unit 720 also functions to prevent the flag in the Leap Year Flag Access Register 725 from changing value if the flag in the Found Flag Register 750 has the "No" value. The flag in the Found Flag Register 750 is set to a "No" value by a Set Found Flag unit 745 at the beginning of the date conversion process, and remains at that value until the date conversion is accomplished. The Gregorian day-of-the-year is stored in binary form in a Binary Gregorian Date Register 730. Because the Gregorian and 360-day-year days-of-the-year in the Date Conversion Table 760 are stored in character form to facilitate inspection and alterations of the entries in the Date Conversion Table 760, a Translate to Character Format unit 735 is required to convert the Gregorian day-of-the-year to a character format for storage in a Month/Day Character Register 740. A search of days-of-the-year in a Date Conversion Table 760 is performed by the Search Table unit 755 according to the flow chart shown in FIG. 29C. First the index variable is set to an initial value of three hundred and sixty seven 910. Then, the value of the leap year flag in the Leap Year Flag Access Register 725 is evaluated 915. Each row of the Date Conversion Table has three fields: a Gregorian leap year field, a Gregorian non-leap year field, and a 360-day-year field. If the leap year flag has the "Yes" value, then it is determined 920 that the Gregorian leap year field of the Date Conversion Table 760 is to be compared to the Gregorian day-of-the-year in the Month/Day Character Register 740. If the leap year flag has the "No" value, then it is determined 925 that the Gregorian non-leap year field of the Date Conversion Table 760 is to be compared to the Gregorian day-of-the-year in the Month/Day Character Register 740. A comparison is then made 930 between the stored Gregorian day-of-the-year (DOTY) in the Month/Day Character Register 740 and the day-of-the-year (DOTY) at the indexed row of the Date Conversion Table 760 in the appropriate field. If a match is not found between the stored Gregorian day-of-the-year (DOTY) in the Month/Day Character Register 740 and the DOTY at the indexed row of the Date Conversion Table 760 in the appropriate field, then the index is decremented by one 940. The value of the index is tested 945, and if it is less than one, then the day-of-the-year (DOTY) in the Month/Day Character Register 740 was not found in the Date Conversion Table 760, and error routines 950 are initiated. If the index value is not less than one then another comparison is made 930 between the stored Gregorian day-of-the-year (DOTY) in the Month/Day Character Register 740 and the DOTY at the indexed row of the Date Conversion Table 760 in the appropriate field. If a match is found during a comparison 930, then the Search Table unit 755 sets the flag in the Found Flag Register 750 to the "Yes" value 935 (enabling the Copy unit 720 to alter the contents of the Leap Year Flag Access Register 725 until another date conversion is begun), and the day-of-the-year (DOTY) at the indexed row in the 360-day-year field is stored 937 in the 360-Day-Year Day-of-the-year Register 770. The system 800 of the present invention for conversion of a 360-day-year day-of-the-year to a Gregorian day-of-the-year is shown in FIG. 29B. The system 800 includes a plurality of storage registers 805, 815, 825, 840, 850 and 870 (shown as rectangular blocks), a plurality of processing units 803, 810, 820, 830, 835, 845, 855, and 865 (shown as oval blocks), and the look-up table 760 (shown as a rectangular block). In the preferred embodiment of the present invention the processing units 803, 810, 820, 835, 845, 855 and 865 are implemented as COBOL computer code. Alternatively, the processing units 803, 810, 820, 835, 845, 855 and 865 may be dedicated hardwired processors. The Search Table unit 855 requires data from a Leap Year Flag Access Register 825, a 360-day-year Character Register 840, and a Found Flag Register 850, so these registers 825, 840 and 850 must be loaded with the appropriate values prior to the search performed by the Search Table unit 855. Therefore, the flow chains beginning with a Load Year unit 803, a Binary 360-day-year Date Register 830, and a Set Found Flag unit 845 must be completed prior to the operation of the Search Table unit 855. The Search Table unit 855 outputs data to the Gregorian Day-of-the-year Register 870 and back to the Found Flag Register 850. Since the Search Complete unit 865 utilizes the flag value in the Found Flag Register 850, the Search Complete unit 865 operates after the Search Table unit 855 has terminated. (For clarity, the control apparatus for initiating the flow chains is not shown in FIG. 29B.) To set the flag in the Leap Year Flag Access Register 825 a year is loaded by a Load Year unit 803 into a Year Register 805. This year in the Year Register 805 is accessed by a Test For Leap Year unit 810 which sets a flag in a Leap Year Flag Buffer Register 815 to a "Yes" value if the year is indeed a leap year, and a "No" value otherwise. The flag in the Leap Year Flag Buffer Register 815 is then copied by a Copy unit 820 to a Leap Year Flag Access Register 825. The Copy unit 820 also functions to prevent the flag in the Leap Year Flag Access Register 825 from changing value if the flag in the Found Flag Register 850 has the "No" value. The flag in the Found Flag Register 850 is set to a "No" value by a Set Found Flag unit 845 at the beginning of the date conversion process, and remains at that value until the date conversion is accomplished. The 360-day-year day-of-the-year is stored in binary form in a Binary 360-Day-Year Date Register 830. The Gregorian and 360-day-year days-of-the-year in the Date Conversion Table 760 are stored in character form to facilitate inspection and alterations of the entries in the Date Conversion Table 760, so a Translate to Character Format unit 835 is required to convert the 360-day-year day-of-the-year to a character format for storage in a 360-Day-Year Character Register 840. A search of days-of-the-year in a Date Conversion Table 760 is performed by the Search Table unit 855 according to the flow chart shown in FIG. 29D. First the index variable is set to an initial value of three hundred and sixty seven 960. A comparison 970 is then made between the stored 360-day-year day-of-the-year (DOTY) in the 360-Day-Year Character Register 840 and the 360-day-year day-of-the-year (DOTY) at the indexed row of the Date Conversion Table 760 in the 360-day-year field. If a match is not found between the stored 360-day-year day-of-the-year (DOTY) in the 360-Day-Year Character Register 840 and the DOTY at the indexed row of the Date Conversion Table 760 in the 360-day-year field, then the index is decremented by one 980. The value of the index is then tested 985, and if it is less than one, then the day-of-the-year in the 360-Day-Year Character Register 840 was not found in the Date Conversion Table 760, and error routines 990 are initiated. If the index value is not less than one then another comparison is made 970 between the stored 360-day-year day-of-the-year (DOTY) in the 360-Day-Year Character Register 840 and the DOTY at the indexed row of the Dat | ||||||
