Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Change the DB2 date format while unloading into file.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: Change the DB2 date format while unloading into file.
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

Active Member


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

PostPosted: Wed Nov 21, 2007 8:37 am    Post subject:
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    Post subject:
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    Post subject:
Reply with quote

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

http://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: 59
Location: home

PostPosted: Fri Nov 23, 2007 2:51 pm    Post subject:
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

Active Member


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

PostPosted: Fri Nov 23, 2007 6:05 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Split file based on comparsion to 2 f... Div Grad DFSORT/ICETOOL 1 Thu Jul 27, 2017 9:16 pm
No new posts Extra character appears in file when ... Balu5491 All Other Mainframe Topics 1 Wed Jul 26, 2017 2:39 pm
No new posts SSH - known_hosts file configuration vasanthz All Other Mainframe Topics 2 Wed Jul 26, 2017 2:10 am
This topic is locked: you cannot edit posts or make replies. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm
No new posts Write out NODUPS but just from one file Jay Villaverde DFSORT/ICETOOL 8 Fri Jul 14, 2017 12:44 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us