Previous Topic: SET_FORMAT Function—Change External Date FormatNext Topic: ADD_YEARS Function—Add Years to a Date


FROM_EXTERNAL Function—Convert CA Earl Date to CA 1 Date

Use the FROM_EXTERNAL function to convert an external date in your CA Earl program (for example, SET MYDATE = 'YYYY/MM/DD') to a CA 1 compatible internal date. You could use this date for comparisons, arithmetic operations, and so on, with other CA 1 internal date fields.

DEF MY_INT_DATE   (P 7.0) = NONE
DEF MY_EXT_DATE   (X 10)  = 'YYYY/MM/DD'
DEF DATE_FORMAT   (X 10)  = NONE

SET DATE_FORMAT = 'YYYY/MM/DD'
SET FUNCTION = 'SET_FORMAT'
CALL CTSEDATE USING FUNCTION
                    DATE_FORMAT

SET FUNCTION = 'FROM_EXTERNAL'
CALL CTSEDATE USING FUNCTION
                    MY_INT_DATE
                    MY_EXT_DATE

Note: Remember, before you can issue the FROM_EXTERNAL function, you must have called CTSEDATE with the SET_FORMAT function and the desired external date format (if different from your installation default date format).