*DECK DLCND USETEXT DLFPDEF USETEXT DLNOD USETEXT OUTCDA PROC DLCND(COM$DATE,SEC$VALUE);# COMPUTE NO OF DAYS DIFFERENCE IN SECONDS # *IF DEF,IMS # *1DC DLCND * * 1. PROC NAME AUTHOR DATE * DLCND P.C.TAM 78/01/14 * * 2. FUNCTIONAL DESCRIPTION * COMPUTE NUMBER OF DAYS DIFFERENCE IN SECONDS * * 3. METHOD USED * IF COM$DATE IS EQUAL TO START DATE, RETURN ZERO. * IF COM$DATE IS LS START DATE, SET INIT$DATE TO * COM$DATE, OFF$DATE TO START DATE, NEGATIVE TO * TRUE, OTHERWISE SET OFF$DATE TO COM$DATE, START * DATE TO INT$DATE, NEGATIVE TO FALSE. * COMPUTE DIFFERENCE BETW OFF$DATE AND INIT$DATE IN * SECONDS. * IF NEGATIVE IS TRUE, RETURN MINUS DIFFERENCE, * OTHERWISE, RETURN DIFFERENCE. * * 4. ENTRY PARAMETERS * COM$DATE DATE TO BE COMPARED * IN YYMMDD FORMAT * SDTYYMMDD START DATE * IN BYY/MM/DD FORMAT * * 5. EXIT PARAMETERS * SEC$VALUE RESULT IN MILLISECONDS, * CAN BE NEGATIVE. * * 6. COMDECKS CALLED AND SYMPL TEXTS USED. * DLFPDEF DLNOD OUTCDA * * 7. ROUTINES CALLED * NONE * * 8. DAYFILE MESSAGES * NONE * # *ENDIF ITEM COM$DATE U, # COMPARE DATE FROM CALLING PROG # SEC$VALUE I, # DIFFERENCE IN SECS # NEGATIVE B, # RESULT PLUS/MINUS FLAG # SUM I, # TEMPORARY SUM VARIABLE # INIDD, # START POINT DAY # INIMM, # START POINT MONTH # INIYY, # START POINT YEAR # FINDD, # END POINT DAY # FINMM, # END POINT MONTH # FINYY, # END POINT YEAR # JLIMIT, # J LOOP LIMIT # EDLIMIT, # DAY IN MONTH LIMIT # I, # LOOP VARIABLE # J, # LOOP VARIABLE # TEMP1; # TEMPORARY VARIABLE # # ******************************************************************** # BEGIN INIYY = (C<1,1> SDTYYMMDD - O"33") * 10 + C<2,1> SDTYYMMDD - O"33"; FINYY = (C<0,1> COM$DATE - O"33") * 10 + C<1,1> COM$DATE - O"33"; INIMM = (C<4,1> SDTYYMMDD - O"33") * 10 + C<5,1> SDTYYMMDD - O"33"; FINMM = (C<2,1> COM$DATE - O"33") * 10 + C<3,1> COM$DATE - O"33"; INIDD = (C<7,1>SDTYYMMDD - O"33") * 10 + C<8,1> SDTYYMMDD - O"33"; FINDD = (C<4,1> COM$DATE - O"33") * 10 + C<5,1> COM$DATE - O"33"; IF INIYY LS 70 THEN INIYY = INIYY + 100; # ADJUST FOR CENTURY # IF FINYY LS 70 THEN FINYY = FINYY + 100; # ADJUST FOR CENTURY # IF FINYY*10000+FINMM*100+FINDD EQ INIYY*10000+INIMM*100+INIDD THEN SEC$VALUE = 0; ELSE BEGIN IF FINYY*10000+FINMM*100+FINDD LS INIYY*10000+INIMM*100+INIDD THEN BEGIN NEGATIVE = TRUE; TEMP1 = FINYY; FINYY = INIYY; INIYY = TEMP1; TEMP1 = FINMM; FINMM = INIMM; INIMM = TEMP1; TEMP1 = FINDD; FINDD = INIDD; INIDD = TEMP1; END ELSE BEGIN NEGATIVE = FALSE; END SUM = 0; JLIMIT = 12; # LOOP TO CALCULATE EACH ELAPSED YEAR # FOR I = INIYY STEP 1 UNTIL FINYY DO BEGIN IF I - I/4*4 EQ 0 THEN NOD[2] = 29; ELSE NOD[2] = 28; IF I EQ FINYY THEN JLIMIT = FINMM; # LOOP TO CALCULATE ELAPSED DAYS IN EACH MONTH # FOR J = INIMM STEP 1 UNTIL JLIMIT DO BEGIN IF I EQ FINYY AND J EQ FINMM THEN EDLIMIT = FINDD - 1; ELSE EDLIMIT = NOD[J]; SUM = SUM + (EDLIMIT - INIDD + 1); INIDD = 1; END INIMM = 1; END # RETURN RESULT # SUM = SUM * 86400000; IF NEGATIVE THEN SEC$VALUE = - SUM; ELSE SEC$VALUE = SUM; END END TERM