User Tools

Site Tools


cdc:nos2.source:nam5871:dlcnd

Table of Contents

DLCND

Table Of Contents

  • [00005] PROC DLCND(COM$DATE,SEC$VALUE)

Source Code

DLCND.txt
  1. *DECK DLCND
  2. USETEXT DLFPDEF
  3. USETEXT DLNOD
  4. USETEXT OUTCDA
  5. PROC DLCND(COM$DATE,SEC$VALUE);# COMPUTE NO OF DAYS DIFFERENCE IN
  6.   SECONDS #
  7. *IF DEF,IMS
  8. #
  9. *1DC DLCND
  10. *
  11. * 1. PROC NAME AUTHOR DATE
  12. * DLCND P.C.TAM 78/01/14
  13. *
  14. * 2. FUNCTIONAL DESCRIPTION
  15. * COMPUTE NUMBER OF DAYS DIFFERENCE IN SECONDS
  16. *
  17. * 3. METHOD USED
  18. * IF COM$DATE IS EQUAL TO START DATE, RETURN ZERO.
  19. * IF COM$DATE IS LS START DATE, SET INIT$DATE TO
  20. * COM$DATE, OFF$DATE TO START DATE, NEGATIVE TO
  21. * TRUE, OTHERWISE SET OFF$DATE TO COM$DATE, START
  22. * DATE TO INT$DATE, NEGATIVE TO FALSE.
  23. * COMPUTE DIFFERENCE BETW OFF$DATE AND INIT$DATE IN
  24. * SECONDS.
  25. * IF NEGATIVE IS TRUE, RETURN MINUS DIFFERENCE,
  26. * OTHERWISE, RETURN DIFFERENCE.
  27. *
  28. * 4. ENTRY PARAMETERS
  29. * COM$DATE DATE TO BE COMPARED
  30. * IN YYMMDD FORMAT
  31. * SDTYYMMDD START DATE
  32. * IN BYY/MM/DD FORMAT
  33. *
  34. * 5. EXIT PARAMETERS
  35. * SEC$VALUE RESULT IN MILLISECONDS,
  36. * CAN BE NEGATIVE.
  37. *
  38. * 6. COMDECKS CALLED AND SYMPL TEXTS USED.
  39. * DLFPDEF DLNOD OUTCDA
  40. *
  41. * 7. ROUTINES CALLED
  42. * NONE
  43. *
  44. * 8. DAYFILE MESSAGES
  45. * NONE
  46. *
  47.  #
  48. *ENDIF
  49.  
  50. ITEM
  51. COM$DATE U, # COMPARE DATE FROM CALLING PROG #
  52. SEC$VALUE I, # DIFFERENCE IN SECS #
  53. NEGATIVE B, # RESULT PLUS/MINUS FLAG #
  54. SUM I, # TEMPORARY SUM VARIABLE #
  55. INIDD, # START POINT DAY #
  56. INIMM, # START POINT MONTH #
  57. INIYY, # START POINT YEAR #
  58. FINDD, # END POINT DAY #
  59. FINMM, # END POINT MONTH #
  60. FINYY, # END POINT YEAR #
  61. JLIMIT, # J LOOP LIMIT #
  62. EDLIMIT, # DAY IN MONTH LIMIT #
  63. I, # LOOP VARIABLE #
  64. J, # LOOP VARIABLE #
  65. TEMP1; # TEMPORARY VARIABLE #
  66.  
  67. # ******************************************************************** #
  68. BEGIN
  69. INIYY = (C<1,1> SDTYYMMDD - O"33") * 10
  70. + C<2,1> SDTYYMMDD - O"33";
  71. FINYY = (C<0,1> COM$DATE - O"33") * 10
  72. + C<1,1> COM$DATE - O"33";
  73. INIMM = (C<4,1> SDTYYMMDD - O"33") * 10
  74. + C<5,1> SDTYYMMDD - O"33";
  75. FINMM = (C<2,1> COM$DATE - O"33") * 10
  76. + C<3,1> COM$DATE - O"33";
  77. INIDD = (C<7,1>SDTYYMMDD - O"33") * 10
  78. + C<8,1> SDTYYMMDD - O"33";
  79. FINDD = (C<4,1> COM$DATE - O"33") * 10
  80. + C<5,1> COM$DATE - O"33";
  81. IF INIYY LS 70 THEN INIYY = INIYY + 100; # ADJUST FOR CENTURY #
  82. IF FINYY LS 70 THEN FINYY = FINYY + 100; # ADJUST FOR CENTURY #
  83. IF FINYY*10000+FINMM*100+FINDD EQ INIYY*10000+INIMM*100+INIDD
  84. THEN
  85. SEC$VALUE = 0;
  86. ELSE
  87. BEGIN
  88. IF FINYY*10000+FINMM*100+FINDD LS INIYY*10000+INIMM*100+INIDD
  89. THEN
  90. BEGIN
  91. NEGATIVE = TRUE;
  92. TEMP1 = FINYY;
  93. FINYY = INIYY;
  94. INIYY = TEMP1;
  95. TEMP1 = FINMM;
  96. FINMM = INIMM;
  97. INIMM = TEMP1;
  98. TEMP1 = FINDD;
  99. FINDD = INIDD;
  100. INIDD = TEMP1;
  101. END
  102. ELSE
  103. BEGIN
  104. NEGATIVE = FALSE;
  105. END
  106. SUM = 0;
  107.  
  108. JLIMIT = 12;
  109. #
  110.   LOOP TO CALCULATE EACH ELAPSED YEAR
  111. #
  112. FOR I = INIYY STEP 1 UNTIL FINYY
  113. DO
  114. BEGIN
  115. IF I - I/4*4 EQ 0
  116. THEN
  117. NOD[2] = 29;
  118. ELSE
  119. NOD[2] = 28;
  120. IF I EQ FINYY
  121. THEN
  122. JLIMIT = FINMM;
  123. #
  124.   LOOP TO CALCULATE ELAPSED DAYS IN EACH MONTH
  125. #
  126. FOR J = INIMM STEP 1 UNTIL JLIMIT
  127. DO
  128. BEGIN
  129. IF I EQ FINYY AND J EQ FINMM
  130. THEN
  131. EDLIMIT = FINDD - 1;
  132. ELSE
  133. EDLIMIT = NOD[J];
  134. SUM = SUM + (EDLIMIT - INIDD + 1);
  135. INIDD = 1;
  136. END
  137. INIMM = 1;
  138. END
  139. #
  140.   RETURN RESULT
  141. #
  142. SUM = SUM * 86400000;
  143. IF NEGATIVE
  144. THEN
  145. SEC$VALUE = - SUM;
  146. ELSE
  147. SEC$VALUE = SUM;
  148. END
  149. END
  150. TERM
cdc/nos2.source/nam5871/dlcnd.txt ยท Last modified: 2023/08/05 17:22 by Site Administrator