User Tools

Site Tools


cdc:nos2.source:nam5871:dlckda

DLCKDA

Table Of Contents

  • [00004] PROC DLCKDA(DATEF, ERRCODE)

Source Code

DLCKDA.txt
  1. *DECK DLCKDA
  2. USETEXT DLFPDEF
  3. USETEXT DLNOD
  4. PROC DLCKDA(DATEF, ERRCODE); # CHECK DATE IN DISPLAY CODE #
  5. *IF DEF,IMS
  6. #
  7. *1DC DLCKDA
  8. *
  9. * 1. PROC NAME AUTHOR DATE.
  10. * DLCKDA P.C.TAM 78/11/07
  11. *
  12. * 2. FUNCTIONAL DESCRIPTION.
  13. * CHECK DATE FIELD FOR VALIDITY.
  14. *
  15. * 3. METHOD USED.
  16. * CHECK EACH DIGIT FOR VALID NUMBER DIGIT,
  17. * CHECK YEAR TO BE GREATER THAN 0
  18. * CHECK MONTH TO BE BETWEEN 1 AND 12,
  19. * CHECK DAY FOR VALID DATE.
  20. *
  21. * 4. ENTRY PARAMETERS.
  22. * DATEF DATE INPUT
  23. *
  24. * 5. EXIT PARAMETERS.
  25. * ERRCODE RETURN CODE FOR ERROR
  26. *
  27. * 6. COMDECKS CALLED AND SYMPL TEXT USED.
  28. * DLFPDEF DLNOD
  29. *
  30. * 7. ROUTINES CALLED.
  31. * NONE.
  32. *
  33. * 8. DAYFILE MESSAGES.
  34. * NONE.
  35. *
  36.  #
  37. *ENDIF
  38.  
  39. #
  40.   LOCAL VARIABLES
  41. #
  42.  
  43.  
  44. ITEM
  45. DATEF U, # DATE FIELD #
  46. ERRCODE I, # ERROR RETURN CODE #
  47. D1 I, # DIGIT ONE #
  48. D2 I, # DIGIT TWO #
  49. D3 I, # DIGIT THREE #
  50. D4 I, # DIGIT FOUR #
  51. D5 I, # DIGIT FIVE #
  52. D6 I, # DIGIT SIX #
  53. YY I, # YEAR #
  54. MM I, # MONTH #
  55. DD I, # DATE #
  56. TEMP1 I; # TEMPORARY VARIABLE #
  57.  
  58. # ******************************************************************** #
  59. BEGIN
  60. D1 = C<0,1>DATEF - O"33";
  61. D2 = C<1,1>DATEF - O"33";
  62. D3 = C<2,1>DATEF - O"33";
  63. D4 = C<3,1>DATEF - O"33";
  64. D5 = C<4,1>DATEF - O"33";
  65. D6 = C<5,1>DATEF - O"33";
  66. YY = D1 * 10 + D2; # YEAR #
  67. MM = D3 * 10 + D4; # MONTH #
  68. DD = D5 * 10 + D6; # DAY #
  69. TEMP1 = YY/4;
  70. IF YY - TEMP1 * 4 EQ 0
  71. THEN
  72. NOD[2] = 29; # LEAP YEAR #
  73. ELSE
  74. NOD[2] = 28;
  75. IF C<6,4>DATEF EQ 0 AND # DATE MUST BE 6 CHARS LONG #
  76. (0 LQ D1 AND D1 LQ 9) AND
  77. (0 LQ D2 AND D2 LQ 9) AND
  78. (0 LQ D3 AND D3 LQ 9) AND
  79. (0 LQ D4 AND D4 LQ 9) AND
  80. (0 LQ D5 AND D5 LQ 9) AND
  81. (0 LQ D6 AND D6 LQ 9) AND
  82. 0 LQ YY AND YY LQ 99 AND # YEAR BETWN 0 AND 99 #
  83. 1 LQ MM AND MM LQ 12 AND # MONTH BETWEEN 1 AND 12 #
  84. 1 LQ DD AND DD LQ NOD[MM] # DATE BETWEEN 1 AND 30 #
  85. THEN
  86. ERRCODE = 0;
  87. ELSE
  88. ERRCODE = 1;
  89. END
  90. TERM
cdc/nos2.source/nam5871/dlckda.txt ยท Last modified: 2023/08/05 17:22 by Site Administrator