MVSFORUMS.com A Community of and for MVS Professionals
View previous topic :: View next topic
Author
Message
jayram99 Beginner Joined: 16 Aug 2004 Posts: 52 Topics: 21 Location: falls church.va,usa
Posted: Wed Feb 16, 2005 10:32 pm Post subject: Date Conversion
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
kolusu Site Admin Joined: 26 Nov 2002 Posts: 12401 Topics: 75 Location: San Jose
Posted: Thu Feb 17, 2005 8:39 am Post subject:
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
jayram99 Beginner Joined: 16 Aug 2004 Posts: 52 Topics: 21 Location: falls church.va,usa
Posted: Thu Feb 17, 2005 9:16 am Post subject:
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
jayram99 Beginner Joined: 16 Aug 2004 Posts: 52 Topics: 21 Location: falls church.va,usa
Posted: Thu Feb 17, 2005 9:55 am Post subject:
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
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