Focal Point
[SOLVED] CYMD date conversion problem

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/1231030213

December 30, 2008, 04:51 PM
Wayne Brown
[SOLVED] CYMD date conversion problem
Trying to convert a CYMD date for the first time from a DB2 table. The date looks like this 1081226.

Tried the following with a blank result and can't seem to stumble onto the Focus equivalent of CYMD.

DATECVT(ACAIDT, 'CYMD', 'YYMD')

Thanks,
Wayne

This message has been edited. Last edited by: Kerry,


7.6.4, iSeries, Windows, DB2
December 30, 2008, 07:22 PM
j.gross
If the CYMD field has an integer (I..) usage in the Synonym file, adding 1900 00 00 will give the yyyymmdd value, and then it's simple to convert to a date field:

-* hold sample data
DEFINE FILE CAR
LIST/I1 WITH COUNTRY = LIST + 1;
CYMD_INT/I8=DECODE LIST(
1 1081226
2 0991231
3 1991231
ELSE 0);
END
TABLE FILE CAR
PRINT CYMD_INT
IF CYMD_INT NE 0
ON TABLE HOLD AS SAMPLE
END

-* transform cymd to yymd:
DEFINE FILE SAMPLE
  
  YYMD_INT/I8YYMD = CYMD_INT + 19000000;
  DATE/YY-M-D = YYMD_INT;

END
TABLE FILE SAMPLE
PRINT CYMD_INT YYMD_INT DATE
END


- Jack Gross
WF through 8.1.05