cdc:nos2.source:nam5871:dlconvh
Table of Contents
DLCONVH
Table Of Contents
- [00003] PROC DLCONVH(INW,OUTW,ERR,DGTS)
Source Code
- DLCONVH.txt
- *DECK DLCONVH
- USETEXT DLFPDEF
- PROC DLCONVH(INW,OUTW,ERR,DGTS); # CONVERT HEX DC TO BINARY. #
- *IF DEF,IMS
- #
- *1DC DLCONVH
- *
- * 1. PROC NAME AUTHOR DATE.
- * DLCONVH P.C.TAM 78/11/07.
- *
- * 2. FUNCTIONAL DESCRIPTION.
- * CONVERT HEXADECIMAL DISPLAY CODED FIELD TO
- * BINARY.
- *
- * 3. METHOD USED.
- * FOR EACH DIGIT, IF BETWEEN 33B AND 44B, GET
- * TRUE VALUE BY SUBTRACTING 33B,
- * IF BETWEEN 01B AND 06B, GET TRUE VALUE BY
- * ADDING 9.
- *
- * 4. ENTRY PARAMETERS.
- * INW INPUT WORD IN DISPLAY CODE.
- *
- * 5. EXIT PARAMETERS.
- * OUTW OUTPUT BINARY RESULT
- * ERR ERROR RETURN CODE
- * DGTS NUMBER OF DIGITS CONVERTED.
- *
- * 6. COMDECKS CALLED AND SYMPL TEXTS USED.
- * DLFPDEF
- *
- * 7. ROUTINES CALLED.
- * NONE.
- *
- * 8. DAYFILE MESSAGES.
- * NONE.
- *
- #
- *ENDIF
- ITEM
- INW U, # INPUT WORD #
- OUTW I, # OUTPUT RESULT #
- ERR I, # CONVERSION OK FLAG #
- DGTS I, # NUMBER OF DIGITS CONVERTED. #
- COMPLETE B, # TEMP VARIABLE #
- DIGIT I, # TEMP VARIABLE #
- I I, # TEMP VARIABLE #
- SUM I; # TEMP VARIABLE #
- # ******************************************************************** #
- BEGIN
- ERR = 0; # PRESET RETURN CODE #
- COMPLETE = FALSE; # SET TEMP VARIABLES #
- SUM = 0;
- FOR I = 0 STEP 1 WHILE I LS WC AND NOT COMPLETE
- DO
- BEGIN
- DIGIT = C<I,1>INW;
- IF 1 LQ DIGIT AND DIGIT LQ 6 # DIGIT IS BETWEEN A AND F #
- THEN
- DIGIT = DIGIT + 9;
- ELSE
- IF O"33" LQ DIGIT AND DIGIT LQ O"44" # DIGIT IS BETWEEN 0/9 #
- THEN
- DIGIT = DIGIT - O"33";
- ELSE
- BEGIN # DIGIT IS NOT A VALID HEX SYMBOL #
- COMPLETE = TRUE;
- DGTS = I; # SET NUMBER OF DIGITS FOUND. #
- IF DIGIT NQ 0
- THEN # NOT END OF FIELD, SOMETHING IS WRONG #
- ERR = 1;
- END
- IF NOT COMPLETE
- THEN
- SUM = SUM * 16 + DIGIT;
- END
- OUTW = SUM;
- END
- TERM
cdc/nos2.source/nam5871/dlconvh.txt ยท Last modified: 2023/08/05 17:22 by Site Administrator