|
User Defined Conversion Codes (U) |
|
|
Users may add their own conversion codes to the system by writing a QMBasic subroutine to perform the conversion.
The format of the conversion code is
Usubrname or Usubrname.extension
where
The subroutine should have four arguments:
CONV.SUBR(result, src, status, oconv)
where
See the U50BB subroutine in the BP file of the QMSYS account for an example of a Pick user exit routine.
Example
The following example subroutine converts a combined date/time value as returned by SYSTEM(1005) to a text representation or vice versa.
SUBROUTINE DT(RESULT, SRC, STATE, IS.OCONV) IF SRC = '' THEN RESULT = '' END ELSE IF IS.OCONV THEN D = IDIV(SRC, 86400) T = REM(SRC, 86400) RESULT = OCONV(D, 'D2/DMY') : ' ' : OCONV(T, 'MTS') END ELSE D = FIELD(SRC, ' ', 1) T = FIELD(SRC, ' ', 2) RESULT = ICONV(D, 'D2/DMY') * 86400 + ICONV(T, 'MTS') END STATE = 0 RETURN END
|