Taking too long? Close loading screen.

DCS Code Segments

Dates

CODE_SEGMENT Dates
; Valuation Date
IF LEN(STRVAL(MONTH(EXTRACT_DATE))) = 1 THEN
    VAL_DATE = STRVAL(YEAR(EXTRACT_DATE)) + "0" + STRVAL(MONTH(EXTRACT_DATE))
ELSE
    VAL_DATE = STRVAL(YEAR(EXTRACT_DATE)) + STRVAL(MONTH(EXTRACT_DATE))
ENDIF


; Last-Year End
LYE_DATE = STRVAL(YEAR(EXTRACT_DATE) - 1) + "12"


; Beginning of Current Year
BOY_DATE = STRVAL(YEAR(EXTRACT_DATE)) + "01"


; Last-Month
LM_M = STRVAL(NUMVAL(SUBSTR(VAL_DATE, 5, 2)) - 1)
IF LEN(LM_M) = 1 THEN
    LM_M = "0" + LM_M
ENDIF
IF LM_M = "00" THEN
    LM_M = "12"
    LM_DATE = STRVAL(NUMVAL(SUBSTR(VAL_DATE, 1, 4)) -1) + LM_M
ELSE
    LM_DATE = SUBSTR(VAL_DATE, 1, 4) + LM_M
ENDIF


; Last-Quarter End
LQE_M = STRVAL(INT((NUMVAL(SUBSTR(VAL_DATE, 5, 2)) - 1) / 3) * 3)
IF LEN(LQE_M) = 1 THEN
    LQE_M = "0" + LQE_M
ENDIF
IF LQE_M = "00" THEN
    LQE_DATE = STRVAL(NUMVAL(SUBSTR(VAL_DATE, 1, 4)) -1) + "12"
ELSE
    LQE_DATE = SUBSTR(VAL_DATE, 1, 4) + LQE_M
ENDIF

END_CODE_SEGMENT;Dates

Processing Records