IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Change the DB2 date format while unloading into file.


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Cketha
Warnings : 1

New User


Joined: 19 May 2007
Posts: 22
Location: mumbai

PostPosted: Thu Nov 15, 2007 12:46 pm
Reply with quote

Hi,

In DB2 table the date format is mm/dd/yyyy.

While unloading table into file using UNLOAD SHRLEVEL CHANGE can i get date format yyyy-mm-dd ? Can you suggest some option.
Back to top
View user's profile Send private message
Phrzby Phil

Senior Member


Joined: 31 Oct 2006
Posts: 1042
Location: Richmond, Virginia

PostPosted: Wed Nov 21, 2007 8:37 am
Reply with quote

The DB2 internal date format is irrelevant to users, and the default output format is yyyy-mm-dd.

When you do a SELECT, do you get mm/dd/yyyy? If so, you must have something set to do so, or your installation must have that as the default setting.

Anyone out there know more than me?
Back to top
View user's profile Send private message
stodolas

Active Member


Joined: 13 Jun 2007
Posts: 632
Location: Wisconsin

PostPosted: Wed Nov 21, 2007 9:36 am
Reply with quote

It is possible, although I hope it isn't this way, that the date field isn't really defined as a date, but a CHAR(10) and the programs are taking care of the logic of working with the date in that format. I've seen it before, not taking advantage of native formats because of legacy code they don't want to change...
Back to top
View user's profile Send private message
stodolas

Active Member


Joined: 13 Jun 2007
Posts: 632
Location: Wisconsin

PostPosted: Wed Nov 21, 2007 9:38 am
Reply with quote

But, if it really is a date format see here:

www.ibm.com/developerworks/db2/library/techarticle/0211yip/0211yip3.html
Back to top
View user's profile Send private message
ruodeer

New User


Joined: 06 Jul 2007
Posts: 58
Location: home

PostPosted: Fri Nov 23, 2007 2:51 pm
Reply with quote

Yes ,you can .

You can reformat the Date column in the Select clause from 'mm/dd/yyyy' to 'yyyy-mm-dd ' using DB2 builtin func !
Back to top
View user's profile Send private message
Phrzby Phil

Senior Member


Joined: 31 Oct 2006
Posts: 1042
Location: Richmond, Virginia

PostPosted: Fri Nov 23, 2007 6:05 pm
Reply with quote

Of course functions can be applied to SELECTed fields, but op implies that the date is coming back mm/dd/yyyy and he wants yyyy-mm-dd.

I would hope that he wouldn't be using a function, then asking how to get it back the standard way.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 2
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
Search our Forums:

Back to Top