User Tools

Site Tools


cdc:nos2.source:nam5871:nvftcct

NVFTCCT

Table Of Contents

  • [00005] PROC NVFTCCT1)
1)
PT),(CTYP),CNTIME,CNTYP)
  • [00006] NVFTCCT - CALCULATE APPLICATION CONNECT TIME
  • [00010] CALCULATE APPLICATION CONNECT TIME.
  • [00054] FUNC XCDD C(10)
</WRAP> === Source Code ===
NVFTCCT.txt
  1. *DECK NVFTCCT
  2. USETEXT TEXTNVF
  3. USETEXT TEXTSS
  4.  
  5. PROC NVFTCCT((PT),(CTYP),CNTIME,CNTYP);
  6. # TITLE NVFTCCT - CALCULATE APPLICATION CONNECT TIME #
  7.  
  8. BEGIN # NVFTCCT #
  9. #
  10. ** NVFTCCT - CALCULATE APPLICATION CONNECT TIME.
  11. *
  12. * E. THAVIKULWAT 81/10/27
  13. * C. BRION 83/02/15
  14. *
  15. * THIS PROCEDURE CALCULATES THE APPLICATION CONNECT TIME. IT IS
  16. * CALLED INTO EXECUTION BY THE FOLLOWING PROCEDURES:
  17. * *NVFTIAM* *NVFTRVD*
  18. *
  19. * PROC NVFTCCT((PT),(CTYPE),CNTIME)
  20. *
  21. * ENTRY:
  22. * PT = POINTER TO PTAC OR PAAC ENTRY
  23. * CTYP = 0 IF NO CONNECT TIME MESSAGE FORMATTING (I.E., XXXXXX)
  24. * 1 IF CONNECT TIME MESSAGE FORMATTING (I.E., HH.MM.SS)
  25. * CNTYP = TYPE INDICATOR FOR EITHER T-A OR A-A SERVICE.
  26. *
  27. * EXIT:
  28. * CNTIME = APPLICATION CONNECT TIME IN DISPLAY CODE, LEFT
  29. * JUSTIFIED WITH BLANK FILLED.
  30. *
  31. * NOTES:
  32. * 1) IF THE APPLICATION CONNECT TIME SPANS FEBRUARY 28 TO MARCH 1
  33. * IN A LEAP YEAR, THE TIME CALCULATED IS 1 DAY SHORT.
  34. * 2) MINIMUM CONNECT TIME IS 1 SECOND AND MAXIMUM CONNECT TIME IS
  35. * 999999 SECONDS (APPROXIMATELY 12 DAYS) IF NO FORMATTING (AEAP
  36. * ACCOUNT MESSAGE) OR 99.59.59 IF FORMATTING.
  37. *
  38. * METHOD:
  39. * CALCULATE NUMBER OF MONTH(S) AND DAY(S) CONNECTED. IF MORE THAN
  40. * ONE MONTH, SET NUMBER OF DAYS CONNECTED TO THE MAXIMUM (12). IF
  41. * CONNECT TIME IS MORE THAN ONE DAY, ADD NUMBER OF SECONDS PER DAY
  42. * MULTIPLIED BY NUMBER OF DAYS TO THE CURRENT TIME TO ARRIVE AT
  43. * THE REAL CURRENT TIME. DETERMINE TOTAL CONNECT TIME BY TAKING
  44. * THE DIFFERENCE BETWEEN CURRENT TIME AND SWITCH TIME. CALL MACRE
  45. * ROUTINE *XCDD* TO CONVERT THE TIME IN SECONDS TO DISPLAY CODE.
  46. #
  47.  
  48. #
  49. **** PROC NVFTCCT - XREF LIST.
  50. #
  51.  
  52. XREF
  53. BEGIN
  54. FUNC XCDD C(10); # CONVERT INTEGER TO DECIMAL DISPLAY CODE #
  55. END
  56.  
  57. #
  58. ****
  59. #
  60. DEF MXDAYS$ #12#; # MAXIMUM NUMBER OF CONNECT DAYS #
  61.  
  62. ITEM CNTIME C(10); # APPLICATION CONNECT TIME #
  63. ITEM CTEMP C(10); # TEMPORARY VARIABLE FOR CHARACTERS #
  64. ITEM CTYP I; # CONNECT TIME TYPE - FORMAT/UNFORMAT #
  65. ITEM CURDAY I; # CURRENT DAY #
  66. ITEM CURMONTH I; # CURRENT MONTH #
  67. ITEM CURTIME I; # CURRENT TIME IN SECONDS #
  68. ITEM DAYDIFF I; # NUMBER OF DAYS CONNECTED #
  69. ITEM ENDSRCH B; # EXIT LOOP VARIABLE #
  70. ITEM I I; # LOOP VARIABLE #
  71. ITEM MNBITMAP I = O"2532 4000 0000 0000 0000"; # 0=28/30,1=31 #
  72. ITEM MONDIFF I; # NUMBER OF MONTHS CONNECTED #
  73. ITEM PT I; # SUBSCRIPT FOR ARRAY PTAC #
  74. ITEM SWTDAY I; # APPLICATION SWITCH DAY #
  75. ITEM SWTMONTH I; # APPLICATION SWITCH MONTH #
  76. ITEM SWTTIME I; # APPLICATION SWITCH TIME IN SECONDS #
  77. ITEM TEMPTIM I; # TEMPORARY VARIABLE FOR TIME #
  78. ITEM TIMDIFF I; # NUMBER OF SECONDS CONNECTED #
  79. ITEM CNTYP I; # TYPE OF CONNECTION #
  80.  
  81. #
  82. * FOLLOWING ARRAY DEFINES THE MAXIMUM APPLICATION CONNECT TIMES.
  83. * 999999 SECS = MAXIMUM UNFORMATTED CONNECT TIME.
  84. * 359999 SECS = 99.59.59 HH.MM.SS MAXIMUM FORMATTED CONNECT TIME.
  85. #
  86. ARRAY MAXTIME[00:01] S(1);
  87. BEGIN
  88. ITEM MXT$TIME I(00,00,60) = [999999,359999];
  89. END
  90.  
  91. #
  92. * FOLLOWING ARRAY DEFINES NUMBER OF SECONDS PER HOUR, MINUTE, AND
  93. * SECONDS.
  94. #
  95. ARRAY NUMSECS[00:02] S(1);
  96. BEGIN
  97. ITEM NSC$SECS I(00,00,60) = [3600,60,1];
  98. END
  99.  
  100. #
  101. * FETCH CURRENT MONTH, CURRENT DAY, SWITCH MONTH, AND SWITCH DAY.
  102. * CONVERT CURRENT TIME AND SWITCH TIME TO SECONDS.
  103. #
  104. CURMONTH = B<6,6>CTM$PDATE[0];
  105. CURDAY = B<12,6>CTM$PDATE[0];
  106. CURTIME = B<0,6>CTM$PCLK[0] * 60; # CONVERT HOURS TO MINUTES #
  107. CURTIME = (CURTIME + B<6,6>CTM$PCLK[0]) * 60; # MINS TO SECNDS #
  108. CURTIME = CURTIME + B<12,6>CTM$PCLK[0]; # TOTAL NUM OF SECONDS #
  109.  
  110. #
  111. * SET THE SWITCH VARIABLES FROM EITHER THE PAAC OR PTAC DEPENDING
  112. * ON THE PASSED CONNECTION TYPE.
  113. #
  114.  
  115. IF CNTYP EQ TATIME$
  116. THEN
  117. BEGIN
  118.  
  119. SWTMONTH = B<0,6>PTA$SWTIME[PT];
  120. SWTDAY = B<6,6>PTA$SWTIME[PT];
  121. SWTTIME = B<12,6>PTA$SWTIME[PT] * 60; # HOURS TO MINUTES #
  122. SWTTIME = (SWTTIME + B<18,6>PTA$SWTIME[PT]) * 60; # MNS TO SEC #
  123. SWTTIME = SWTTIME + B<24,6>PTA$SWTIME[PT]; # TOTAL NUM OF SECS #
  124.  
  125. END
  126. ELSE IF (CNTYP EQ AATIME$)
  127. THEN
  128. BEGIN # A-A CONNECTION TYPE #
  129.  
  130. SWTMONTH = B<0,6>PA$SWTIME[PT];
  131. SWTDAY = B<6,6>PA$SWTIME[PT];
  132. SWTTIME = B<12,6>PA$SWTIME[PT] * 60; # HRS TO MIN #
  133. SWTTIME = (SWTTIME + B<18,6>PA$SWTIME[PT]);
  134. SWTTIME = SWTTIME + B<24,6>PA$SWTIME[PT];
  135.  
  136. END
  137. ELSE
  138. BEGIN # TERMINAL SESSION CONNECTION TYPE #
  139.  
  140. SWTMONTH = B<0,6>PTA$CNTIME[PT];
  141. SWTDAY = B<6,6>PTA$CNTIME[PT];
  142. SWTTIME = B<12,6>PTA$CNTIME[PT]*60; # HRS TO MINS #
  143. SWTTIME = (SWTTIME+B<18,6>PTA$CNTIME[PT])*60; # MINS TO SECS #
  144. SWTTIME = SWTTIME+B<24,6>PTA$CNTIME[PT];
  145.  
  146. END
  147.  
  148. #
  149. * CALCULATE NUMBER OF MONTH(S) CONNECTED. IF CURRENT MONTH LESS
  150. * THAN SWITCH MONTH, THEN YEAR BOUNDARY WAS CROSSED AND ACTUAL
  151. * NUMBER OF MONTHS IS ARRIVED AT BY ADDING 12 TO THE DIFFERENCE.
  152. #
  153. MONDIFF = CURMONTH - SWTMONTH;
  154. IF (MONDIFF LS 0)
  155. THEN # CROSSED YEAR BOUNDARY #
  156. BEGIN
  157. MONDIFF = MONDIFF + 12;
  158. END
  159. #
  160. * CALCULATE NUMBER OF DAY(S) CONNECTED. IF CURRENT DAY IS LESS
  161. * THAN SWITCH DAY, THAN MONTH BOUNDARY WAS CROSSED AND MONTH
  162. * DIFFERENCE IS 1 LESS. IF MONTH BOUNDARY WAS CROSSED AND MONTH
  163. * CONNECTED IS LESS THAN 1, ACTUAL NUMBER OF DAYS IS ARRIVED AT BY
  164. * ADDING 28/30/31 (DEPENDING ON SWITCH MONTH) TO THE DIFFERENCE.
  165. #
  166. DAYDIFF = CURDAY - SWTDAY;
  167. IF (DAYDIFF LS 0)
  168. THEN # CROSSED MONTH BOUNDARY"#
  169. BEGIN
  170. MONDIFF = MONDIFF - 1;
  171. IF (MONDIFF EQ 0)
  172. THEN # LESS THAN 1 MONTH #
  173. BEGIN
  174. DAYDIFF = DAYDIFF + B<SWTMONTH,1>MNBITMAP + 30; # ADD 30/31 #
  175. IF (SWTMONTH EQ 2)
  176. THEN # SWITCH MONTH IS FEBRUARY #
  177. BEGIN
  178. DAYDIFF = DAYDIFF - 2; # 28 DAYS FOR FEBRUARY #
  179. END
  180. END
  181. END
  182. #
  183. * IF CONNECTED FOR ONE OR MORE MONTHS, SET NUMBER OF DAYS CONNECTED
  184. * TO THE MAXIMUM (12 DAYS).
  185. #
  186. IF (MONDIFF NQ 0)
  187. THEN # MORE THAN 1 MONTH #
  188. BEGIN
  189. DAYDIFF = MXDAYS$; # MAXIMUM NUMBER OF DAYS #
  190. END
  191. #
  192. * CALCULATE TOTAL CONNECT TIME.
  193. #
  194. IF (DAYDIFF NQ 0)
  195. THEN # CONNECTED FOR MORE THAN 1 DAY #
  196. BEGIN
  197. CURTIME = CURTIME + (DAYDIFF * (24 * 3600)); # ACTUAL CURTIME #
  198. END
  199.  
  200. TIMDIFF = CURTIME - SWTTIME;
  201. IF (TIMDIFF LQ 0)
  202. THEN # LESS THAN ONE SECOND #
  203. BEGIN
  204. TIMDIFF = 1; # SET TO MINIMUM CONNECT TIME #
  205. END
  206. ELSE # ONE SECOND OR MORE #
  207. BEGIN
  208. IF (TIMDIFF GR MXT$TIME[CTYP])
  209. THEN # GREATER THAN MAXIMUM ALLOWED #
  210. BEGIN
  211. TIMDIFF = MXT$TIME[CTYP]; # SET TO MAXIMUM TIME ALLOWED #
  212. END
  213. END
  214. #
  215. * CONVERT TOTAL CONNECT TIME TO THE REQUESTED FORMAT IN DISPLAY
  216. * CODE.
  217. #
  218. IF (CTYP EQ 0)
  219. THEN # NO MESSAGE FORMATTING #
  220. BEGIN
  221. CTEMP = XCDD(TIMDIFF); # CONVERT TO DISPLAY CODE #
  222. ENDSRCH = FALSE;
  223. FOR I = 0 STEP 1 WHILE (NOT ENDSRCH AND I LS 10)
  224. DO
  225. BEGIN
  226. IF (C<I,1>CTEMP NQ " ")
  227. THEN # FOUND NON-BLANK CHARACTER #
  228. BEGIN
  229. CNTIME = C<I,10-I>CTEMP; # LEFT JUSTIFIED, BLANK FILLED #
  230. ENDSRCH = TRUE; # EXIT LOOP #
  231. END
  232. END
  233. END
  234. ELSE # MESSAGE FORMATTING REQUIRED #
  235. BEGIN
  236. CNTIME = " "; # BLANK FILL #
  237. FOR I = 0 STEP 1 UNTIL 2
  238. DO
  239. BEGIN # CONVERT SECS TO HH.MM.SS #
  240. TEMPTIM = TIMDIFF / NSC$SECS[I];
  241. TIMDIFF = TIMDIFF - (TEMPTIM * NSC$SECS[I]);
  242. TEMPTIM = TEMPTIM + 100; # ENSURE LEADING ZERO #
  243. CTEMP = XCDD(TEMPTIM);
  244. C<I*3,2>CNTIME = C<8,2>CTEMP;
  245. END
  246. C<2,1>CNTIME = ".";
  247. C<5,1>CNTIME = ".";
  248. END
  249.  
  250. END # END NVFTCCT #
  251.  
  252. TERM
cdc/nos2.source/nam5871/nvftcct.txt ยท Last modified: 2023/08/05 17:23 by Site Administrator