User Tools

Site Tools


cdc:nos2.source:nam5871:dlconvh

DLCONVH

Table Of Contents

  • [00003] PROC DLCONVH(INW,OUTW,ERR,DGTS)

Source Code

DLCONVH.txt
  1. *DECK DLCONVH
  2. USETEXT DLFPDEF
  3. PROC DLCONVH(INW,OUTW,ERR,DGTS); # CONVERT HEX DC TO BINARY. #
  4. *IF DEF,IMS
  5. #
  6. *1DC DLCONVH
  7. *
  8. * 1. PROC NAME AUTHOR DATE.
  9. * DLCONVH P.C.TAM 78/11/07.
  10. *
  11. * 2. FUNCTIONAL DESCRIPTION.
  12. * CONVERT HEXADECIMAL DISPLAY CODED FIELD TO
  13. * BINARY.
  14. *
  15. * 3. METHOD USED.
  16. * FOR EACH DIGIT, IF BETWEEN 33B AND 44B, GET
  17. * TRUE VALUE BY SUBTRACTING 33B,
  18. * IF BETWEEN 01B AND 06B, GET TRUE VALUE BY
  19. * ADDING 9.
  20. *
  21. * 4. ENTRY PARAMETERS.
  22. * INW INPUT WORD IN DISPLAY CODE.
  23. *
  24. * 5. EXIT PARAMETERS.
  25. * OUTW OUTPUT BINARY RESULT
  26. * ERR ERROR RETURN CODE
  27. * DGTS NUMBER OF DIGITS CONVERTED.
  28. *
  29. * 6. COMDECKS CALLED AND SYMPL TEXTS USED.
  30. * DLFPDEF
  31. *
  32. * 7. ROUTINES CALLED.
  33. * NONE.
  34. *
  35. * 8. DAYFILE MESSAGES.
  36. * NONE.
  37. *
  38.  #
  39. *ENDIF
  40.  
  41. ITEM
  42. INW U, # INPUT WORD #
  43. OUTW I, # OUTPUT RESULT #
  44. ERR I, # CONVERSION OK FLAG #
  45. DGTS I, # NUMBER OF DIGITS CONVERTED. #
  46. COMPLETE B, # TEMP VARIABLE #
  47. DIGIT I, # TEMP VARIABLE #
  48. I I, # TEMP VARIABLE #
  49. SUM I; # TEMP VARIABLE #
  50.  
  51. # ******************************************************************** #
  52.  
  53. BEGIN
  54. ERR = 0; # PRESET RETURN CODE #
  55. COMPLETE = FALSE; # SET TEMP VARIABLES #
  56. SUM = 0;
  57. FOR I = 0 STEP 1 WHILE I LS WC AND NOT COMPLETE
  58. DO
  59. BEGIN
  60. DIGIT = C<I,1>INW;
  61. IF 1 LQ DIGIT AND DIGIT LQ 6 # DIGIT IS BETWEEN A AND F #
  62. THEN
  63. DIGIT = DIGIT + 9;
  64. ELSE
  65. IF O"33" LQ DIGIT AND DIGIT LQ O"44" # DIGIT IS BETWEEN 0/9 #
  66. THEN
  67. DIGIT = DIGIT - O"33";
  68. ELSE
  69. BEGIN # DIGIT IS NOT A VALID HEX SYMBOL #
  70. COMPLETE = TRUE;
  71. DGTS = I; # SET NUMBER OF DIGITS FOUND. #
  72. IF DIGIT NQ 0
  73. THEN # NOT END OF FIELD, SOMETHING IS WRONG #
  74. ERR = 1;
  75. END
  76. IF NOT COMPLETE
  77. THEN
  78. SUM = SUM * 16 + DIGIT;
  79. END
  80. OUTW = SUM;
  81. END
  82. TERM
cdc/nos2.source/nam5871/dlconvh.txt ยท Last modified: 2023/08/05 17:22 by Site Administrator