Mainframe Utility: HEX2DEC

Return to Mainframe Utilities Page

Module


/**********************************************************************
/* UTILITY: HEX2DEC                                                   *
/* AUTHOR: DAVID LEIGH                                                *
/* FUNCTION: THIS CLIST CALLS PROGRAM HEX2DECP TO CONVERT HEXADECIMAL *
/*           NUMBERS TO DECIMAL NUMBERS.                              *
/**********************************************************************
PROC 1 HEXNUM BATCH
/**** SET MESSAGE DISPLAY ON/OFF BASED ON THE DEBUG SWITCH ***/
ISPEXEC VGET (DBGSWTCH) PROFILE
IF &DBGSWTCH = &STR(ON) THEN CONTROL MSG LIST CONLIST SYMLIST NOFLUSH
ELSE CONTROL NOMSG NOLIST NOFLUSH NOPROMPT
IF &HEXNUM = &STR(HELP) THEN GOTO HELPSEC
/**********************************************************************
/* CALL THE CONVERSION PROGRAM                                        *
/**********************************************************************
ISPEXEC SELECT PGM(HEX2DECP) PARM(&HEXNUM)
ISPEXEC VGET DECNUM SHARED

IF &BATCH ¬= BATCH THEN +
    DO
        SET ZEDLMSG = &STR(HEXADECIMAL NUMBER &HEXNUM = +
                           DECIMAL NUMBER &DECNUM)
        ISPEXEC SETMSG MSG(UTLZ000)
    END
EXIT
HELPSEC: +                                                              04470000
CLEAR                                                                   04470000
WRITE *** HELP FOR CLIST HEX2DEC ***                                    04470000
WRITE                                                                   04470000
WRITE NO HELP WRITTEN AT THIS TIME                                      04470000
WRITE                                                                   04470000
WRITE *** END OF HELP *** NO PROCESSING PERFORMED ***                   04470000
EXIT                                                                    04470000
            


Documentation

 This CLIST will convert an input number in hexadecimal format to decimal format
 and display it on the screen.  The syntax is simple and as follows :
 
 COMMAND ===> TSO HEX2DEC 345FF
 
 The output message from this example would be
 
 HEXADECIMAL NUMBER 345FF = DECIMAL NUMBER 214527
 
 Due to the limitations in TSO, the input number cannot be greater than 8
 digits.            


Leave a Reply

Your email address will not be published. Required fields are marked *