Tools and utilities that are hard to be categorised are listed as the following:
The reason of the CVTHC program's birth is quite simple, it is handy for an OPM or ILE HLL program to convert a hexadecimal value to character format. The CVTHC MI instruction cannot be used in a bound program (an ILE program). Also, an OPM HLL program cannot use MI instructions, and hence cannot utilize the CVTHC instruction. Although service program QSYS/QC2UTIL1 exports a procedure, cvthc, that implements the functionality of the CVTHC instruction, the cvthc procedure is really inconvenient to use, since the user must bind to *SRVPGM QSYS/QC2UTIL1 directly or indirectly via the *BNDDIR QSYS/QC2LE. While, using the CVTHC program in a ILE HLL program is convenient, you need to do nothing but an external program call.
The CVTHC program has three parameters:
The following are pieces of HLL programs that utilize the CVTHC program.
DCL VAR(&MITYP) TYPE(*UINT) LEN(2) VALUE(X'1901') DCL VAR(&MSG) TYPE(*CHAR) LEN(16) DCL VAR(&NIBLEN) TYPE(*UINT) LEN(4) VALUE(4) CALL PGM(CVTHC) PARM(&MSG &MITYP &NIBLEN)
PGM DCL VAR(&TMPL) TYPE(*CHAR) LEN(32) DCL VAR(&LEN) TYPE(*UINT) LEN(4) VALUE(32) DCL VAR(&BYTESIN) TYPE(*INT) STG(*DEFINED) + LEN(4) DEFVAR(&TMPL) DCL VAR(&BYTESOUT) TYPE(*INT) STG(*DEFINED) + LEN(4) DEFVAR(&TMPL 5) DCL VAR(&UUID) TYPE(*CHAR) STG(*DEFINED) LEN(16) + DEFVAR(&TMPL 17) DCL VAR(&MSG) TYPE(*CHAR) LEN(32) DCL VAR(&NIBLEN) TYPE(*UINT) LEN(4) VALUE(32) CALLPRC PRC('_PROPB') PARM((&TMPL *BYREF) (X'00' + *BYVAL) (&LEN *BYVAL)) CHGVAR VAR(&BYTESIN) VALUE(&LEN) CALLPRC PRC('_GENUUID') PARM((&TMPL *BYREF)) CALL PGM(CVTHC) PARM(&MSG &UUID &NIBLEN) SNDPGMMSG MSG(&MSG) ENDPGM
process NOMONOPRC. id division. program-id. cbl002. environment division. configuration section. special-names. copy mih-lnktyp. data division. working-storage section. copy mih-spt. 01 result pic x(32). 01 tmpl type uuid-t. 01 uuid-len pic 9(9) usage comp-4 value 32. procedure division. main-pgm. move all x"00" to tmpl. move 32 to bytes-in of tmpl. call "_GENUUID" using by reference tmpl. call program "CVTHC" using by reference result by reference uuid of tmpl by reference uuid-len. display "UUID generated: " result. see-you. stop run.