SQL DB2 COBOL date reformatting
I want to use DB2 SQL in COBOL to reformat a date from
CCYY-MM-DD to MM-DD-YY. What is the simplest and most efficient way to do this?
Christy
SELECTsentence you can use the
VARCHAR_FORMATscalar function to make your dates look as you want.
Looking for relevant AS/400 Whitepapers? Visit the Search400.com Research Library.
Sloopy | May 8 2008 8:26AM GMT
I hope this does not sound like a stupid question, but are you intending only to use the embedded SQL to reformat dates? If so, then this is overkill.
I ask this because I saw a tip somewhere recently where it was recommended to use embedded SQL to reformat dates. This is OK if you were going to use SQL ANYWAY, but not if it’s the only thing you want to use it for. Otherwise, there are lots of ways to reformat a date within the COBOL language.