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 

SELECT DATE MM/DD/YY AND DISPLAY CCYY/MM/DD.

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


Joined: 08 Sep 2007
Posts: 86
Topics: 27

PostPosted: Fri Mar 04, 2011 12:23 pm    Post subject: SELECT DATE MM/DD/YY AND DISPLAY CCYY/MM/DD. Reply with quote

Hi everyone.
I want to select a date which is stored as MM/DD/YY and I want to see my query displaying CCYY/MM/DD at spufi and in my cobol program of course..
Any help?
Thanks
_________________
The more I learn, the more I want to learn.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Fri Mar 04, 2011 1:07 pm    Post subject: Reply with quote

prog_mario,

Assuming you have both 1900 and 2000 dates use the following Untested sql which will give you the desired results

Code:

SELECT CASE WHEN SUBSTR(DATE_COL,7,2) > '50'         
            THEN CHAR('19') || SUBSTR(DATE_COL,7,2) 
            ELSE CHAR('20') || SUBSTR(DATE_COL,7,2) 
             END            ||                       
       SUBSTR(DATE_COL,6,1) ||                       
       SUBSTR(DATE_COL,1,3) ||                       
       SUBSTR(DATE_COL,4,2)                         
  FROM Table
  ;         


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