MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Date Conversion

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
jayram99
Beginner


Joined: 16 Aug 2004
Posts: 52
Topics: 21
Location: falls church.va,usa

PostPosted: Wed Feb 16, 2005 10:32 pm    Post subject: Date Conversion Reply with quote

Hi,

At present i have date format(DB2) mm/dd/yyyy and i need date to be converted in the format yymmdd.

I want to execute the sql query in SAS application and write to a flat file.

Pl. help me to resolve this.

Jayaram
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12401
Topics: 75
Location: San Jose

PostPosted: Thu Feb 17, 2005 8:39 am    Post subject: Reply with quote

jayaram99,

try this

Code:

SELECT SUBSTR('mm/dd/yyyy',9,2) CONCAT   
       SUBSTR('mm/dd/yyyy',1,2) CONCAT   
       SUBSTR('mm/dd/yyyy',4,2)         
  FROM  SYSIBM.SYSDUMMY1;


Hope this helps...

Cheers

kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
jayram99
Beginner


Joined: 16 Aug 2004
Posts: 52
Topics: 21
Location: falls church.va,usa

PostPosted: Thu Feb 17, 2005 9:16 am    Post subject: Reply with quote

Srihari,

If i code the query, will get the value from the first argument specified as string. The querry will return A.(First 2 Characters from A.DT_GR_FUNDG).

Actually I should get value from the date.

SELECT A.NBR_GRP,
SUBSTR('A.DT_GRP_FUNDG',1,2)

FROM UDBADM.MRTG_GRP A, UDBADM.CD_DLP B
WHERE A.CD_DLP=B.CD_DLP
AND B.CD_FMLY_TYPE = 'SF'




The results are
------------------------------------------------------------------------

NBR_GRP 2
------- --
H008701 A.
H008703 A.
H008702 A.

At present the DT_GRP_FUNDG column in table has 01/28/2005 , I should get 050128.

Thanks
Jayaram
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
jayram99
Beginner


Joined: 16 Aug 2004
Posts: 52
Topics: 21
Location: falls church.va,usa

PostPosted: Thu Feb 17, 2005 9:55 am    Post subject: Reply with quote

kolusu,

Got the results, Thanks for the same.

I used the following query to get the results as per the requirement.
Code:

SELECT   A.NBR_GRP,
                char(replace(substr(char(a.DT_GRP_FUNDG,iso),3),'-',''),6),
                A.DT_GRP_PAYF
FROM     UDBADM.MRTG_GRP A, UDBADM.CD_DLP B
WHERE    A.CD_DLP=B.CD_DLP
AND      B.CD_FMLY_TYPE = 'SF'
and   A.nbr_grp in ('H008701','H008702','H008703')


Results are
Code:

------------------------------------------------------------------------

NBR_GRP 2      DT_GRP_PAYF
------- ------ -----------
H008701 050128 -         
H008703 050128 -         
H008702 050128 -         


Regards,
Jayaram
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group