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 

Decimal to date conversion in QMF

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


Joined: 05 Jan 2003
Posts: 17
Topics: 7

PostPosted: Thu Jan 16, 2003 3:46 am    Post subject: Decimal to date conversion in QMF Reply with quote

Hello,
I have a date data stored in DB2 tables as decimal data type.But while reporting i need to format the data in the date fmt.ie my data in DB2 tables is as follows:
000118
But i want it in the following format in the report:
00/01/18
Any way of doing this in QMF?

Regards,
Bindu
Back to top
View user's profile Send private message Send e-mail
Manas Biswal
Intermediate


Joined: 29 Nov 2002
Posts: 382
Topics: 27
Location: Chennai, India

PostPosted: Thu Jan 16, 2003 6:27 am    Post subject: Reply with quote

You can use edit codes in the FORM section of QMF after running your query. But I think a date format edit code will not be alllowed for a numeric data type. If you are exporting your report to a dataset, then you can always do whatever formatting you like in your dataset.

Regards,
Manas
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
kolusu
Site Admin
Site Admin


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

PostPosted: Thu Jan 16, 2003 7:05 am    Post subject: Reply with quote

Bindu,
You can use the DIGITS function to get the desired results. I assumed that your column is defined as decimal 6 .try the following sql

Code:

SELECT SUBSTR(DIGITS(COLUMN_NAME),1,2)
       CONCAT '/' CONCAT             
       SUBSTR(DIGITS(COLUMN_NAME),3,2)
       CONCAT '/' CONCAT             
       SUBSTR(DIGITS(COLUMN_NAME),5,2)
       AS SYSTEM_DATE                 
       FROM TABLENAME               
       ;                             


Hope this helps...

cheers

kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
bindu
Beginner


Joined: 05 Jan 2003
Posts: 17
Topics: 7

PostPosted: Thu Jan 16, 2003 9:33 pm    Post subject: Reply with quote

Thanks .. It worked .. The method we tried earlier was to give the rexx function in the field definition of our qmf form.
The procedure we tried is as follows:
We retrieved the data as scuh from the db2 tables.the data we got was 118.Then we defined another field which will pad the data for zeroese.The field definition for this was written as follows:
RIGHT(&1,6,0) ..&1 is the id of the colomn which contains raw data from the table.

Then we defined another field to format the date and wrote the field definition for this as follows:
SUBSTR(&3,1,2)||'/'||INSERT('/',SUBSTR(&3,3,6),2) -- &3 is the field which contains date with proper data of length 6.

This final field will be displayed in our report.

This is a much round about method .

The method suggested by you simplified our tasks a lot.

Thanks for the solution ...
Smile
But when we gave the query as such as suggested by you the result we got was as follows:

00/00/11

But when we gave
SELECT
SUBSTR(DIGITS(columnname),2,2)
CONCAT '/' CONCAT
SUBSTR(DIGITS(columnnameT),4,2)
CONCAT '/' CONCAT
SUBSTR(DIGITS(columnname),6,2)
AS SYSTEM_DATE
FROM table name
we got the desired result
ie
00/01/18
This should be because our field was defined to be of decimal of length 7 and not 6.

Thanks a lot for the suggestions

Regards,


Bindu
Back to top
View user's profile Send private message Send e-mail
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