CAL0-1512-H5
CAL/2000 (timeCALendar/2000 Tool) is an enabler to bypass the issues with date routines, and has support to the year 3,000. These callable routines return not only the Julian date such as IBM's CVTDAT command but this complete list of information without any overhead. The information returned on one call includes: CENTURY, YEAR, MONTH, DAY, JULIAN DAYS, DAY OF WEEK#, DAY OF WEEK, DAY OF WEEK WITHIN MONTH, HOLIDAY FLAG (user controlled), NON-WORK DAY FLAG, LEAP YEAR, ABSOLUTE DAYS > 1900, CCYYMMDD, YYMMDD, MMDDCCYY, MMDDYY, DDMMCCYY, DDMMYY, CCYYJJJ, YYJJJ, DAY NAME (literal), and MONTH NAME (literal).
Your AS/400 can be supporting the year 3000 in minimal efforts and can use existing date fields in your files. CAL/2000 does all this in one tenth the CPU overhead of IBM's routines to get just the julian date and day of week calculations. The archaic routines with multiplication etc. are a thing of the past.
CAL/2000 eliminates the requirement for costly decimal overflows in your current software. Why leave these routines of the past in your code to burn up CPU for the next millennium.
Date programming efforts are simplified with a call interface. Written in MI (Machine Interface Assembler) code to ensure portability in the future, as well as maximum performance.
Remember, PERFORMANCE is everything!!!! Our benchmarks showed IBM's routines to be 10x more expensive in CPU and yours are probably even more expensive. WHY!!! Use CAL/2000 and BYPASS all your problems.
OS/400 3.1.0 or higher
TimeZone/400 Version 1.1.0 or higher, TestTime/400 Version 5.1.0 or higher, if ROLLING TIME and DATE function
is used within those products.
NOTE:Based on "CALSETYR" command parameters previously issued.CALDAY (Absolute Days)
0002.00 ICALDS E DSCALDS 0007.00 C CALL 'CALDAY' <======CAL/2000 Function 0008.00 C PARM CALADY DAYX 90 (pass packed) 0009.00 C PARM CALDS 0010.00 C PARM *BLANKS MSGID 7
CALCMD (CCYYMMDD)
0002.00 ICALDS E DSCALDS 0007.00 C CALL 'CALCMD' <====CAL/2000 Function 0008.00 C PARM CALCMD CMD 80 (pass packed) 0009.00 C PARM CALDS 0010.00 C PARM *BLANKS MSGID 7
CALYMD (YYMMDD)
0002.00 ICALDS E DSCALDS 0007.00 C CALL 'CALYMD' <====CAL/2000 Function 0008.00 C PARM CALYMD YMD 60 (pass packed) 0009.00 C PARM CALDS 0010.00 C PARM *BLANKS MSGID 7
NOTE:Based on "CALSETYR" command parameters previously issued.
CALMDC (MMDDCCYY)
0002.00 ICALDS E DSCALDS 0007.00 C CALL 'CALMDC' <====CAL/2000 Function 0008.00 C PARM CALMDC MDC 80 (pass packed) 0009.00 C PARM CALDS 0010.00 C PARM *BLANKS MSGID 7
CALMDY (MMDDYY)
0002.00 ICALDS E DSCALDS 0007.00 C CALL 'CALMDY' <=====CAL/2000 Function 0008.00 C PARM CALMDY MDY 60 (pass packed) 0009.00 C PARM CALDS 0010.00 C PARM *BLANKS MSGID 7
NOTE:Based on "CALSETYR" command parameters previously issued.
CALDMC (DDMMCCYY)
0002.00 ICALDS E DSCALDS 0007.00 C CALL 'CALDMC' <====CAL/2000 Function 0008.00 C PARM CALDMC DMC 80 (pass packed) 0009.00 C PARM CALDS 0010.00 C PARM *BLANKS MSGID 7
CALDMY (DDMMYY)
0002.00 ICALDS E DSCALDS 0007.00 C CALL 'CALDMY' <====CAL/2000 Function 0008.00 C PARM CALDMY DMY 60 (pass packed) 0009.00 C PARM CALDS 0010.00 C PARM *BLANKS MSGID 7
NOTE:Based on "CALSETYR" command parameters previously issued.
CALCYJ (CCYYJJJ)
0002.00 ICALDS E DSCALDS 0007.00 C CALL 'CALCYJ' <====CAL/2000 Function 0008.00 C PARM CALCYJ CYJ 70 (pass packed) 0009.00 C PARM CALDS 0010.00 C PARM *BLANKS MSGID 7
CALYJ (YYJJJ)
0002.00 ICALDS E DSCALDS 0007.00 C CALL 'CALYJ' <=====CAL/2000 Function 0008.00 C PARM CALYJ YJ 50 (pass packed) 0009.00 C PARM CALDS 0010.00 C PARM *BLANKS MSGID 7
NOTE:Based on the SYSTEM DATE not the Job's date, unless you are running our TestTime/400 (TT/400) NOWseries package to override the SYSTEM's date. In this case you are asking for data without passing anything to CAL/2000 to convert.
CALCUR (CURRENT DATE)
0001.00 FCALV10 CF E WORKSTN 0002.00 ICALDS E DSCALDS 0003.00 C CLEARCALDS 0004.00 C *INKC DOUEQ*ON 0005.00 C CALL 'CALCUR' <=====CAL/2000 Function 0006.00 C PARM CALDS 0007.00 C PARM *BLANKS MSGID 7 0008.00 C EXFMTSCRN01 0009.00 C ENDDO 0010.00 C MOVE *ON *INLR
NOTE:Based on the one byte century concept.
CALBYMD (BYYMMDD)
0002.00 ICALDS E DSCALDS 0003.00 C CLEARCALDS 0004.00 C Z-ADD*ZEROS BDATE 0005.00 C *INKC DOUEQ*ON 0006.00 C EXFMTSCRN01 0007.00 C *INKC IFEQ *OFF 0008.00 C CALL 'CALBYMD' <=====CAL/2000 Function 0009.00 C PARM BDATE BBDAT 70 (pass packed) 0010.00 C PARM CALDS 0011.00 C PARM *BLANKS MSGID 7 0012.00 C ENDIF 0013.00 C ENDDO 0014.00 C MOVE *ON *INLR
NOTE:Based on the ISO standard date concept. CAL/2000 is called with the ISO date and is returning everything else, but that.
CALISO (CCYY-MM-DD)
0002.00 ICALDS E DSCALDS 0003.00 C CLEARCALDS 0004.00 C MOVE *BLANKS CALISO 0005.00 C *INKC DOUEQ*ON 0006.00 C EXFMTSCRN01 0007.00 C *INKC IFEQ *OFF 0008.00 C CALL 'CALISO' <=====CAL/2000 Function 0009.00 C PARM CALISO 0010.00 C PARM CALDS 0011.00 C PARM *BLANKS MSGID 7 0012.00 C ENDIF 0013.00 C ENDDO 0014.00 C MOVE *ON *INLR
NOTE:CAL/2000 is called with the number of days to add to a date and CAL/2000 is returning the answer in the data structure CALDS.
CALADD (ADD Days to DATE)
0002.00 ICALDS E DSCALDS 961113 0003.00 C CLEARCALDS 961113 0004.00 C Z-ADD*ZEROS DAYS 980628 0005.00 C Z-ADD*ZEROS DATE 980628 0006.00 C *INKC DOUEQ*ON 961113 0007.00 C EXFMTSCRN01 961113 0008.00 C *INKC IFEQ *OFF 961113 0009.00 C CALL 'CALADD' <=====CAL/2000 Function 980628 0010.00 C PARM DAYS DAYX 90 (pass packed) 980628 0011.00 C PARM DATE DATEX 80 (pass packed) 980628 0012.00 C PARM CALDS 961113 0013.00 C PARM *BLANKS MSGID 7 961113 0014.00 C ENDIF 961113 0015.00 C ENDDO 961113 0016.00 C MOVE *ON *INLR 961113
NOTE:CAL/2000 is called with the number of days to subtract to from a date and CAL/2000 is returning the answer in the data structure CALDS.
CALSUB (SUBTRACT Days from a DATE)
0002.00 ICALDS E DSCALDS 961113 0003.00 C CLEARCALDS 961113 0004.00 C Z-ADD*ZEROS DAYS 980628 0005.00 C Z-ADD*ZEROS DATE 980628 0006.00 C *INKC DOUEQ*ON 961113 0007.00 C EXFMTSCRN01 961113 0008.00 C *INKC IFEQ *OFF 961113 0009.00 C CALL 'CALSUB' <=====CAL/2000 Function 980628 0010.00 C PARM DAYS DAYX 90 (pass packed) 980628 0011.00 C PARM DATE DATEX 80 (pass packed) 980628 0012.00 C PARM CALDS 961113 0013.00 C PARM *BLANKS MSGID 7 961113 0014.00 C ENDIF 961113 0015.00 C ENDDO 961113 0016.00 C MOVE *ON *INLR 961113
NOTE:Get the last day of week in a month.
CALGETLT (GET LAST day of WEEK in a MONTH)
0002.00 ICALDS E DSCALDS 961113 0003.00 C CLEARCALDS 961113 0004.00 C Z-ADD*ZEROS MONTH 980628 0005.00 C Z-ADD*ZEROS YEAR 980628 0006.00 C Z-ADD*ZEROS WDAY 980628 0007.00 C *INKC DOUEQ*ON 961113 0008.00 C EXFMTSCRN01 961113 0009.00 C *INKC IFEQ *OFF 961113 0010.00 C CALL 'CALGETLT'<=====CAL/2000 Function 980628 0011.00 C PARM MONTH MX 20 (pass packed) 980628 0012.00 C PARM YEAR YX 40 (pass packed) 980628 0013.00 C PARM WDAY WX 10 (pass packed) 980628 0014.00 C PARM CALDS 961113 0015.00 C PARM *BLANKS MSGID 7 961113 0016.00 C ENDIF 961113 0017.00 C ENDDO 961113 0018.00 C MOVE *ON *INLR 961113
NOTE:Get the difference back in days between any two dates.
CALDIF (GET Difference Between DATEs)
0001.00 ICALDS E DSCALDS 961113 0002.00 C Z-ADD*ZEROS CMD1 980628 0003.00 C Z-ADD*ZEROS CMD2 980628 0004.00 C Z-ADD*ZEROS DAYS 980628 0005.00 C Z-ADD*ZEROS INC 980628 0006.00 C *INKC DOUEQ*ON 961113 0007.00 C EXFMTSCRN01 961113 0008.00 C *INKC IFEQ *OFF 961113 0009.00 C CALL 'CALDIF' <=====CAL/2000 Function 980628 0010.00 C PARM CMD1 CX1 80 (pass packed) 980628 0011.00 C PARM CMD2 CX2 80 (pass packed) 980628 0012.00 C PARM INC INCX 10 (pass packed) 980628 0013.00 C DAYS PARM *ZEROS DAYX 90 (pass packed) 980628 0014.00 C PARM *BLANKS MSGID 7 961113 0015.00 C ENDIF 961113 0016.00 C ENDDO 961113 0017.00 C MOVE *ON *INLR 961113
NOTE:Get back literal for a date in CALTITLE.
CALTITLE (GET Literal)
0009.00 C CALL 'CALTITLE'<=====CAL/2000 Function 0010.00 C PARM CMD1 CX1 80 (pass packed) 0011.00 C TITLE PARM *BLANKS TX 28 980628 0012.00 C PARM *BLANKS MSGID 7 961113
NOTE:Convert to 1 Byte century format in CAL2BYMD.
CAL2BYMD (CONVERT to 1 Byte Century Format)
0013.00 C CALL 'CAL2BYMD'<=====CAL/2000 Function 0014.00 C PARM CMD1 CX1 80 (pass packed) 0015.00 C BYMD PARM *ZEROS BX 70 (pass packed)
NOTE:Convert to ISO format in CAL2ISO.
CAL2ISO (CONVERT to ISO Format)
0016.00 C CALL 'CAL2ISO' <=====CAL/2000 Function 0017.00 C PARM CMD1 CX1 80 (pass packed) 0018.00 C ISO PARM *ZEROS IX 10 980628
NOTE:Get back 1 Byte Century Julian date format.
CAL2BYJ (Convert to BYYJJJ Format)
0013.00 C CALL 'CAL2BYJ' <=====CAL/2000 Function 980720 0014.00 C PARM CALCMD CYMD 80 (pass packed) 980720 0015.00 C PARM *ZEROS BJUL 60 (pass packed) 980720 0016.00 C PARM *BLANKS MSGID 7 980720
NOTE:Get back full date information data structure for 6 Byte Julian BYYJJJ.
CALBYJ (GET Calendar Information by BYYJJJ Format)
0021.00 C CALL 'CALBYJ' <=====CAL/2000 Function 980720 0022.00 C PARM BJUL 60 (pass packed) 980720 0023.00 C PARM CALDS 980720 0024.00 C PARM *BLANKS MSGID 7 980720
NOTE:Add work days only to a date passed, ignoring non-workdays and holidays.
CALADDW (ADD Work Days Only to DATE)
0001.00 ICALDS E DSCALDS 961113 0009.00 C CALL 'CALADDW' <=====CAL/2000 Function 980820 0010.00 C PARM DAYS DAYX 90 (pass packed) 980628 0011.00 C PARM DATE DATEX 80 (pass packed) 980628 0012.00 C PARM CALDS 961113 0013.00 C PARM *BLANKS MSGID 7 961113
NOTE:Subtract work days only to a date passed, ignoring non-workdays and holidays.
CALSUBW (SUBTRACT Work Days Only from DATE)
0001.00 ICALDS E DSCALDS 961113 0009.00 C CALL 'CALSUBW' <=====CAL/2000 Function 980820 0010.00 C PARM DAYS DAYX 90 (pass packed) 980628 0011.00 C PARM DATE DATEX 80 (pass packed) 980628 0012.00 C PARM CALDS 961113 0013.00 C PARM *BLANKS MSGID 7 961113
NOTE:Get the difference in work days only between any two dates.
CALDIFW (GET Difference in Work Days Only)
0009.00 C CALL 'CALDIFW' <=====CAL/2000 Function 980820 0010.00 C PARM CMD1 CX1 80 (pass packed) 980628 0011.00 C PARM CMD2 CX2 80 (pass packed) 980628 0012.00 C PARM INC INCX 10 (pass packed) 980628 0013.00 C DAYS PARM *ZEROS DAYX 90 (pass packed) 980628 0014.00 C PARM *BLANKS MSGID 7 961113
COBOL Example
0034.00 * 0035.00 *--------------------------------------------------------- 0036.00 * SCREEN WORKING AREA 0037.00 *--------------------------------------------------------- 0038.00 * 0039.00 01 SCRN01-OUTPUT. 0040.00 COPY DD-SCRN01-O OF CALV02. 0041.00 01 SCRN01-INPUT. 0042.00 COPY DD-SCRN01-I OF CALV02. 0043.00 0044.00 01 CALDS. 0045.00 COPY DD-RCALTAB-I OF CALDS. 0046.00 0047.00 01 CALDAT. 0048.00 05 CALCMD PIC 99999999 COMP-3. 0049.00 0050.00 01 CALMSG. 0051.00 05 MSGID PIC XXXXXXX. 0052.00 0058.00 *--------------------------------------------------------------- 0059.00 * FILES WORKING AREA 0060.00 *--------------------------------------------------------------- 0061.00 * 0062.00 0063.00 01 DISPLAY-STATUS PIC XX. 0064.00 0065.00 * 0066.00 *--------------------------------------------------------------- 0067.00 * 0068.00 *--------------------------------------------------------------- 0069.00 * 0070.00 0071.00 PROCEDURE DIVISION. 0072.00 0073.00 * 0074.00 *--------------------------------------------------------------- 0075.00 * MAIN ROUTINE 0076.00 *--------------------------------------------------------------- 0077.00 * 0078.00 0079.00 START-PARAGRAPH. 0080.00 0081.00 OPEN I-O SCREEN-FILE. 0082.00 0083.00 MOVE 19961225 TO CALCMD OF CALDAT. 0084.00 MOVE SPACE TO MSGID OF CALMSG. 0085.00 0086.00 CALL "CALCMD" USING CALDAT, CALDS, CALMSG END-CALL. 0087.00 0088.00 0089.00 SET ENTER-KEY TO TRUE. 0090.00 0091.00 0092.00 0093.00 PERFORM DISPLAY-SCRN01 WITH TEST BEFORE UNTIL F3. 0094.00 0095.00 CLOSE SCREEN-FILE. 0096.00 0097.00 STOP RUN. 0098.00 0099.00 DISPLAY-SCRN01. 0100.00 0101.00 MOVE CORR RCALTAB OF CALDS 0102.00 TO SCRN01-O OF SCRN01-OUTPUT. 0103.00 0104.00 MOVE MSGID OF CALMSG TO MSGID OF SCRN01-O. 0105.00 0106.00 WRITE SCREEN-RECORD FROM SCRN01-OUTPUT 0107.00 FORMAT IS "SCRN01" 0108.00 END-WRITE. 0109.00 0110.00 READ SCREEN-FILE INTO SCRN01-INPUT 0111.00 FORMAT IS "SCRN01" END-READ. 0112.00 0113.00 MOVE CALCMD OF SCRN01-I TO CALCMD OF CALDAT. 0114.00 MOVE SPACE TO MSGID OF CALMSG. 0115.00 0116.00 CALL "CALCMD" USING CALDAT, CALDS, CALMSG END-CALL. 0117.00 0118.00
NOTE:These fields are returned on each and every call to any of the API's.Get Calendar Info By Absolute Days (CALDAY) API
The Get Calendar Information By Absolute Days (CALDAY) API validates and returns back calendar information data structure. Required Parameter Group Absolute Days INPUT; Packed(9,0) The absolute days number to get calendar info for. Valid values are: 1 - 400000 Date Information Data Structure OUTPUT; CHAR(*) The calendar date information data structure. See CAL/2000 Return Values for data structure info. Error Code OUTPUT; CHAR(7) The error code. See Error Messages.
Get Calendar Info By Century, Year, Month, Day (CALCMD) API
The Get Calendar Information By Century, Year, Month, Day (CALCMD) API validates and returns back calendar information data structure. Required Parameter Group Century, Year, Month, Day CCYYMMDD INPUT; Packed(8,0) The century, year, month, day to get calendar info for. Valid values are: 1900/01/01 - 3000/12/25 Date Information Data Structure OUTPUT; CHAR(*) The calendar date information data structure. See CAL/2000 Return Values for data structure info. Error Code OUTPUT; CHAR(7) The error code. See Error Messages.
Get Calendar Info By Year, Month, Day (CALYMD) API
The Get Calendar Information By Year, Month, Day (CALYMD) API validates and returns back calendar information data structure. Required Parameter Group Year, Month, Day YYMMDD INPUT; Packed(6,0) The year, month, day to get calendar info for. Date Information Data Structure OUTPUT; CHAR(*) The calendar date information data structure. See CAL/2000 Return Values for data structure info. Error Code OUTPUT; CHAR(7) The error code. See Error Messages.
Get Calendar Info By Month, Day, Century, Year (CALMDC) API
The Get Calendar Information By Month, Day, Century, Year (CALMDC) API validates and returns back calendar information data structure. Required Parameter Group Month, Day, Century, Year MMDDCCYY INPUT; Packed(8,0) The month, day, century, year to get calendar info for. Valid values are: 01/01/1900 - 12/25/3000 Date Information Data Structure OUTPUT; CHAR(*) The calendar date information data structure. See CAL/2000 Return Values for data structure info. Error Code OUTPUT; CHAR(7) The error code. See Error Messages.
Get Calendar Info By Month, Day, Year (CALMDY) API
The Get Calendar Information By Month, Day, Year (CALMDY) API validates and returns back calendar information data structure. Required Parameter Group Month, Day, Year MMDDYY INPUT; Packed(6,0) The month, day, year to get calendar info for. Date Information Data Structure OUTPUT; CHAR(*) The calendar date information data structure. See CAL/2000 Return Values for data structure info. Error Code OUTPUT; CHAR(7) The error code. See Error Messages.
Get Calendar Info By Day, Month, Century, Year (CALDMC) API
The Get Calendar Information By Day, Month, Century, Year (CALDMC) API validates and returns back calendar information data structure. Required Parameter Group Day, Month, Century, Year DDMMCCYY INPUT; Packed(8,0) The day, month, century, year to get calendar info for. Valid values are: 01/01/1900 - 25/12/3000 Date Information Data Structure OUTPUT; CHAR(*) The calendar date information data structure. See CAL/2000 Return Values for data structure info. Error Code OUTPUT; CHAR(7) The error code. See Error Messages.
Get Calendar Info By Day, Month, Year (CALDMY) API
The Get Calendar Information By Day, Month, Year (CALDMY) API validates and returns back calendar information data structure. Required Parameter Group Day, Month, Year DDMMYY INPUT; Packed(6,0) The day, month, year to get calendar info for. Date Information Data Structure OUTPUT; CHAR(*) The calendar date information data structure. See CAL/2000 Return Values for data structure info. Error Code OUTPUT; CHAR(7) The error code. See Error Messages.
Get Calendar Info By Century, Year, Julian Day (CALCYJ) API
The Get Calendar Information By Century, Year, Julian Day (CALCYJ) API validates and returns back calendar information data structure. Required Parameter Group Century, Year, Julian Day CCYYJJJ INPUT; Packed(7,0) The century, year, julian day to get calendar info for. Date Information Data Structure OUTPUT; CHAR(*) The calendar date information data structure. See CAL/2000 Return Values for data structure info. Error Code OUTPUT; CHAR(7) The error code. See Error Messages.
Get Calendar Info By Year, Julian Day (CALYJ) API
The Get Calendar Information By Year, Julian Day (CALYJ) API validates and returns back calendar information data structure. Required Parameter Group Year, Julian Day YYJJJ INPUT; Packed(5,0) The year, julian day to get calendar info for. Date Information Data Structure OUTPUT; CHAR(*) The calendar date information data structure. See CAL/2000 Return Values for data structure info. Error Code OUTPUT; CHAR(7) The error code. See Error Messages.
Get *CURRENT Date Calendar Info (CALCUR) API
The Get Current date Calendar Information (CALCUR) API returns back calendar information data structure with the system's date, unless overriden by our TestTime/400 (TT/400) which is available from INPRO to override for testing purposes the systems date itself. Required Parameter Group Date Information Data Structure OUTPUT; CHAR(*) The calendar date information data structure. See CAL/2000 Return Values for data structure info. Error Code OUTPUT; CHAR(7) The error code. See Error Messages.
Get Calendar Info By One Byte Century, Year, Month, Day (CALBYMD) API
The Get Calendar Information By One Byte Century, Year, Month, Day (CALBYMD) API validates and returns back calendar information data structure. Required Parameter Group Century, Year, Month, Day BYYMMDD INPUT; Packed(7,0) The (one byte) century, year, month, day to get calendar info for. Date Information Data Structure OUTPUT; CHAR(*) The calendar date information data structure. See CAL/2000 Return Values for data structure info. Error Code OUTPUT; CHAR(7) The error code. See Error Messages.
Get Calendar Info By ISO Format (CALISO) API
The Get Calendar Information By ISO Format (CALISO) API validates and returns back calendar information data structure. Required Parameter Group Century, Year, "-", Month, "-", Day CCYY-MM-DD NOTE:The positions where the "-" appear (position 5 and position 8) could be anything such as an "*" or "/". INPUT; Character(10) The century, year, month, day to get calendar info for. Date Information Data Structure OUTPUT; CHAR(*) The calendar date information data structure. See CAL/2000 Return Values for data structure info. Error Code OUTPUT; CHAR(7) The error code. See Error Messages.
ADD Days to DATE (CALADD) API
ADD Days to DATE (CALADD) API validates, adds specified number of days to a date and returns back calendar information data structure. Required Parameter Group Days INPUT; Packed(9,0) The number of days to be added to date in parameter 2. Date, CAL/2000 date CCYYMMDD INPUT; Packed(8,0) The date you are adding days to in parameter 1. Date Information Data Structure OUTPUT; CHAR(*) The calendar date information data structure. See CAL/2000 Return Values for data structure info. Error Code OUTPUT; CHAR(7) The error code. See Error Messages.
SUBTRACT Days from a DATE (CALSUB) API
SUBTRACT some number of Days from a DATE (CALSUB) API validates, subtracts specified number of days to a date and returns back calendar information data structure. Required Parameter Group Days INPUT; Packed(9,0) The number of days to be subtracted from date in parameter 2. Date, CAL/2000 date CCYYMMDD INPUT; Packed(8,0) The date you are subtracting days from in parameter 1. Date Information Data Structure OUTPUT; CHAR(*) The calendar date information data structure. See CAL/2000 Return Values for data structure info. Error Code OUTPUT; CHAR(7) The error code. See Error Messages.
Get Last day of a WEEK in any MONTH (CALGETLT) API
The Get Last day of a WEEK in any MONTH (CALGETLT) API validates, looks up the last specified day of a week in the specified year and month and returns back calendar information data structure. Required Parameter Group Month, MM INPUT; Packed(2,0) The month involved. Year, CCYY INPUT; Packed(4,0) The year your looking for. Day, D INPUT; Packed(1,0) The day of week your looking for. 1 - Monday 2 - Tuesday 3 - Wednesday 4 - Thursday 5 - Friday 6 - Saturday 7 - Sunday Date Information Data Structure OUTPUT; CHAR(*) The calendar date information data structure. See CAL/2000 Return Values for data structure info. Error Code OUTPUT; CHAR(7) The error code. See Error Messages.
Get Difference between DATEs (CALDIF) API
The Get Difference between DATEs (CALDIF) API validates, finds the number of days between 2 dates and returns the difference. Required Parameter Group Date1, CCYYMMDD INPUT; Packed(8,0) The first date of 2 for difference calculation involved. Date2, CCYYMMDD INPUT; Packed(8,0) The second date of 2 for difference calculation involved. Inc, I INPUT; Packed(1,0) The include option lets you specify what to do with the end days of a range of dates include or exclude etc. 0 - Include Neither Date 1 - Include One Date 2 - Include Both Dates Diff, INPUT; Packed(9,0) The difference in days between the dates specified. Error Code OUTPUT; CHAR(7) The error code. See Error Messages.
Get Literal Date Information (CALTITLE) API
The Get Literal Date Information (CALTITLE) API validates and returns back the dates literal information. Required Parameter Group Date1, CCYYMMDD INPUT; Packed(8,0) The date you want a literal version of returned. Literal, OUTPUT; CHAR(28) The literal version of date. Date Title example returned.....Tuesday June 30, 1998 Error Code OUTPUT; CHAR(7) The error code. See Error Messages.
Convert to 1 BYTE Century Format (CAL2BYMD) API
The Convert to 1 BYTE Century Format (CAL2BYMD) API validates and returns back a 7 position 1 BYTE Century format date. Required Parameter Group Date1, CCYYMMDD INPUT; Packed(8,0) The date for which you want a 7 position 1 BYTE century format of returned. Byte1, BYYMMDD OUTPUT; Packed(7,0) The date you want a 1 BYTE century format of returned.
Convert to ISO Format (CAL2ISO) API
The Convert to ISO Format (CAL2ISO) API converts and returns back a 10 position ISO format date. Required Parameter Group Date1, CCYYMMDD INPUT; Packed(8,0) The date for which you want a 10 position ISO format of returned. Iso, CCYY-MM-DD OUTPUT; CHAR(10) The ISO date you wanted is returned.
Convert to 6 Byte Julian Format (CAL2BYJ) API
The Convert to 6 Byte Julian Format (CAL2BYJ) API converts and returns back a 6 position Julian format date. Required Parameter Group Date1, CCYYMMDD INPUT; Packed(8,0) The date for which you want a 6 position Julian format of returned. Julian, BYYJJJ OUTPUT; Packed(6,0) The Julian date you wanted is returned. Error Code OUTPUT; CHAR(7) The error code. See Error Messages.
Get Calendar Information by Century Byte, Year, and Julian Days Format (CALBYJ) API
The Get Calendar Information by Century Byte, Year, and Julian Days Format (CALBYJ) API validates and returns back calendar information data structure. Required Parameter Group Date1, BYYJJJ INPUT; Packed(6,0) The Julian date for which you want the date information data structure returned. Date Information Data Structure OUTPUT; CHAR(*) The calendar date information data structure. See CAL/2000 Return Values for data structure info. Error Code OUTPUT; CHAR(7) The error code. See Error Messages.
ADD Work Days to DATE (CALADDW) API
ADD Work Days to DATE (CALADDW) API validates, adds work days only, ignoring non-work days and holidays and returns back calendar information data structure. Required Parameter Group Days, INPUT; Packed(9,0) The number of days to be added. Date, CAL/2000 date CCYYMMDD INPUT; Packed(8,0) The date to which work days are added, ignored if non-workday or holiday itself. Date Information Data Structure OUTPUT; CHAR(*) The calendar date information data structure. See CAL/2000 Return Values for data structure info. Error Code OUTPUT; CHAR(7) The error code. See Error Messages.
SUBTRACT Work Days from DATE (CALSUBW) API
SUBTRACT Work Days Only from a DATE (CALSUBW) API validates, subtracts only work days and returns back calendar information data structure. Required Parameter Group Days, INPUT; Packed(9,0) The number of days to be subtracted. Date, CAL/2000 date CCYYMMDD INPUT; Packed(8,0) The date to which work days are subtracted, ignored if non-workday or holiday itself. Date Information Data Structure OUTPUT; CHAR(*) The calendar date information data structure. See CAL/2000 Return Values for data structure info. Error Code OUTPUT; CHAR(7) The error code. See Error Messages.
Get Difference between DATES in Work Days (CALDIFW) API
The Get Difference between DATES in Work Days (CALDIFW) API validates, and returns the difference between two dates in work days only, and returns back calendar information data structure. Required Parameter Group Date1, CCYYMMDD INPUT; Packed(8,0) The first date of 2 for work day difference calculation involved. Date2, CCYYMMDD INPUT; Packed(8,0) The second date of 2 for work day difference calculation involved. Inc, I INPUT; Packed(1,0) The include option lets you specify what to do with the end days of a range of dates include or exclude etc. 0 - Include Neither Date 1 - Include One Date 2 - Include Both Dates Diff, OUTPUT; Packed(9,0) The difference in work days between the dates specified. Error Code OUTPUT; CHAR(7) The error code. See Error Messages.
Print Holidays And Non-Work Days (CALPRT01) API and CMD
The Print Holidays And Non-Work Days (CALPRT01) API and CMD prints holidays and non-work days for a date range. Required Parameter Group Century, Year, Month, Day CCYYMMDD - Command Keyword FROM INPUT; Packed(8,0) The century, year, month, day to start from. Valid dates are: 1900/01/01 - 3000/12/25 Century, Year, Month, Day CCYYMMDD - Command Keyword TO INPUT; Packed(8,0) The century, year, month, day to start to. Valid dates are: 1900/01/01 - 3000/12/25
Change Calendar (CHGCAL) API and CMD
The Change Calendar (CHGCAL) API and Command allows to change the active calendar for all CAL APIs and CMDs. This API and CMD log a completion message to the job's joblog. Message: "Now using calendar xxxx for this job." Required Parameter Group Calendar Name - Command Keyword CALNAME INPUT; CHAR(10) The name of the calendar be used. Valid name are calendar created by CRTCAL API or CMD. If left blank then it defualts to calendar INPROCAL which is the base calendar. Error Code - Command Keyword ERROR OUTPUT; CHAR(7) The error code. See Error Messages.
Create Calendar (CHGCAL) API and CMD
The Create Calendar (CRTCAL) API and Command allows to create a new calendar for different countries, allocations, etc.. which holidays and non-workdays are different. Required Parameter Group Calendar Name - Command Keyword CALNAME INPUT; CHAR(10) The name of the calendar to be created. Any valid AS/400 name can be used.
CAL/2000 Return Values
Standard data structure layout
CALDS (External Data Structure) CALEXE/QDDSSRC(CALDS) 0001.00 A R RCALTAB 0002.00 A CALCC 2S 0 TEXT('CENTERY') 0003.00 A CALYY 2S 0 TEXT('YEAR') 0004.00 A CALMM 2S 0 TEXT('MONTH') 0005.00 A CALDD 2S 0 TEXT('DAY') 0006.00 A CALJUL 3S 0 TEXT('JULIAN DAYS') 0007.00 A CALDOW 1S 0 TEXT('DAY OF WEEK# 1-MON 7-SUN') 0008.00 A CALDWM 1S 0 TEXT('DAY OF WEEK. 1ST..5TH') 0009.00 A CALDWL 1S 0 TEXT('DAY OF WEEK 1-LAST,0-NO') 0010.00 A CALHDY 1S 0 TEXT('HOLIDAY FLAG 1-YES,0-NO') 0011.00 A CALNWK 1S 0 TEXT('NON-WORK DAY 1-YES,0-NO') 0012.00 A CALLEP 1S 0 TEXT('LEAP YEAR 1-YES,0-NO') 0013.00 A CALADY 9S 0 TEXT('ABSOLUTE DAYS>1900/2000') 0014.00 A CALCMD 8S 0 TEXT('CCYYMMDD') 0015.00 A CALYMD 6S 0 TEXT('YYMMDD') 0016.00 A CALMDC 8S 0 TEXT('MMDDCCYY') 0017.00 A CALMDY 6S 0 TEXT('MMDDYY') 0018.00 A CALDMC 8S 0 TEXT('DDMMCCYY') 0019.00 A CALDMY 6S 0 TEXT('DDMMYY') 0020.00 A CALCYJ 7S 0 TEXT('CCYYJJJ') 0021.00 A CALYJ 5S 0 TEXT('YYJJJ') 0022.00 A CALDNM 9 TEXT('DAY NAME') 0023.00 A CALMNM 9 TEXT('MONTH NAME')
1/18/99 10:09:39 Page: 1
Printout Of Holidays And Non-Work Days
Range: 2011/01/01 - 2011/12/31
__________ ____________ _________ _________ _______ ________
2011/01/01 40544 Saturday January No Yes
2011/01/02 40545 Sunday January No Yes
2011/01/08 40551 Saturday January No Yes
2011/01/09 40552 Sunday January No Yes
2011/01/15 40558 Saturday January No Yes
2011/01/16 40559 Sunday January No Yes
2011/01/22 40565 Saturday January No Yes
2011/01/23 40566 Sunday January No Yes
2011/01/29 40572 Saturday January No Yes
2011/01/30 40573 Sunday January No Yes
2011/02/05 40579 Saturday February No Yes
2011/02/06 40580 Sunday February No Yes
2011/02/12 40586 Saturday February No Yes
2011/02/13 40587 Sunday February No Yes
2011/02/19 40593 Saturday February No Yes
None.