How to: |
Available Languages: reporting, Maintain
The HINPUT function converts an alphanumeric string to a date-time value.
HINPUT(source_length, 'source_string', output_length, output)
where:
Integer
Is the number of characters in the source string to be converted. You can supply the actual value, the name of a numeric field that contains the value, or an expression that returns the value.
Alphanumeric
Is the string to be converted enclosed in single quotation marks, the name of an alphanumeric field that contains the string, or an expression that returns the string. The string can consist of any valid date-time input value.
Integer
Is the length of the returned date-time value. Valid values are:
Date-time
Is the returned date-time value. Is a field that contains the result, or the format of the output value enclosed in single quotation marks. The format must be in date-time format (data type H).
HCNVRT converts the TRANSDATE field to alphanumeric format, then HINPUT converts the alphanumeric string to a date-time value:
TABLE FILE VIDEOTR2 PRINT CUSTID TRANSDATE AS 'DATE-TIME' AND COMPUTE ALPHA_DATE_TIME/A20 = HCNVRT(TRANSDATE, '(H17)', 17, 'A20'); DT_FROM_ALPHA/HYYMDS = HINPUT(14, ALPHA_DATE_TIME, 8, 'HYYMDS'); WHERE DATE EQ 2000; END
The output is:
CUSTID DATE-TIME ALPHA_DATE_TIME DT_FROM_ALPHA ------ --------- --------------- ------------- 1237 2000/02/05 03:30 20000205033000000 2000/02/05 03:30:00 1118 2000/06/26 05:45 20000626054500000 2000/06/26 05:45:00
HINPUT converts the DT1 field to alphanumeric format:
MAINTAIN FILE DATETIME COMPUTE RESULT/HMtDYYmA = HINPUT(20,'19971029133059888999',10,RESULT); TYPE RESULT; END