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 

db2 date to julain date conversion

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


Joined: 18 Jan 2003
Posts: 13
Topics: 7
Location: 7/2,rams Apartments,Chennai1-14

PostPosted: Sat Jan 18, 2003 7:21 am    Post subject: db2 date to julain date conversion Reply with quote

Hello DB2 pals,
I have done extensive search and alast gave up!
I have some 10,000 records of feed having julian dates to be mapped with db2 iso date format...I have this program in easytrieve...
What I am to do is search for julian date in table having date in yyyy-mm-dd format.My thoughts
were like get table date in julian format using
year and julain_day and concat them and later compare them with input feed to get status code...
I jus wanted 2 know if there were any better ways to do..
Any thoughts...
Thanks & Regards
Jagadish
--------------------

M.JAGADISH GAGLANI
_________________
JAGADISH
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger MSN Messenger
kolusu
Site Admin
Site Admin


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

PostPosted: Sat Jan 18, 2003 8:44 am    Post subject: Reply with quote

Jagadish,

If I understand you correctly you have a input file which has date in the julian format(YYDDD) and you want to select the records from a db2 table which has ISO format date(ccyy-mm-dd).

Easytrieve comes with macros which can convert date from one format to another. So use the macro DATECONV to convert the julian date to ISO format date. The following program does the converison for you.Make sure you have the PANDD DSN which has the macros in your JCL.

In this example I used today's date in julian format as 03018 and the result from the macro is 2003-01-18

you can customize this job to convert the julian date in the input and then select the record from the db2 table.

If you want to see the documentation of this macro, the main page of mvsforums has easytrieve manual.Look under macro's or search for dateconv

Code:
 

//STEP0100 EXEC PGM=EZTPA00                 
//*                                         
//STEPLIB  DD DSN=EASYTREV.LOADLIB,
//            DISP=SHR                       
//PANDD    DD DSN=EASYTREV.MACLIB,
//            DISP=SHR                         
//SYSPRINT DD SYSOUT=*                       
//SYSSNAP  DD SYSOUT=*                       
//SYSIN    DD *                                             

  DEFINE W-JUL-DATE                   W  05  N 0 VALUE 03018
  DEFINE W-ISO-DATE                   W  08  N 0           
  DEFINE W-CCYY      W-ISO-DATE          04  N 0           
  DEFINE W-MM        W-ISO-DATE       +4 02  N 0           
  DEFINE W-DD        W-ISO-DATE       +6 02  N 0           
                                                           
  DEFINE W-DB2-DATE                   W  10  A             
  DEFINE CCYY        W-DB2-DATE          04  N 0           
  DEFINE FILLER1     W-DB2-DATE       +4 01  A VALUE '-'   
  DEFINE MM          W-DB2-DATE       +5 02  N 0           
  DEFINE FILLER2     W-DB2-DATE       +7 01  A VALUE '-'   
  DEFINE DD          W-DB2-DATE       +8 02  N 0           
                                                           
  JOB INPUT NULL 

    %DATECONV  W-JUL-DATE  YYDDD  W-ISO-DATE  CCYYMMDD THRESHOLD 50
                                                                   
    DISPLAY W-JUL-DATE                                             
                                                                   
    CCYY    = W-CCYY                                               
    MM      = W-MM                                                 
    DD      = W-DD                                                 
                                                                   
    DISPLAY W-DB2-DATE                                             
                                                                   
    STOP                                                           

/*                                                                           


Hope this helps...

cheers

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


Joined: 18 Jan 2003
Posts: 13
Topics: 7
Location: 7/2,rams Apartments,Chennai1-14

PostPosted: Sun Jan 19, 2003 8:09 am    Post subject: Reply with quote

Hello
Sorry to be back again.In my shop , I dont' find the libraries specified by you...But I do find a sampjal having dateconv....
My question is if just defined that sampjcl as DSN Would mY JCL pick up the code and execute the macro,without the existence of maclib and loadlib.

Please send me some info..
Jagadish
_________________
JAGADISH
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger MSN Messenger
kolusu
Site Admin
Site Admin


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

PostPosted: Sun Jan 19, 2003 8:59 am    Post subject: Reply with quote

Jagdish,

You can replicate the above posted jcl to sampjcl you have. i.e see the PANDD statement in the sampjcl and take the DSN name it is refering to and use it in the jcl posted above.similary for the loadlib.

Hope this helps...

cheers

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


Joined: 18 Jan 2003
Posts: 13
Topics: 7
Location: 7/2,rams Apartments,Chennai1-14

PostPosted: Mon Jan 20, 2003 8:52 am    Post subject: Reply with quote

hello kolusu,
I could not find the macro lib at my shop.So I tried extracting days of year alone from db2 table and then compared them with the input julian date...Anyways I would like to close the thread...

Jagadish,,,
_________________
JAGADISH
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger MSN Messenger
blitz
Beginner


Joined: 24 Dec 2002
Posts: 28
Topics: 4

PostPosted: Mon Jan 22, 2007 11:57 pm    Post subject: Reply with quote

Is there anything in z/OS cobol to map julian dates to db2 iso date format?
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Tue Jan 23, 2007 9:26 am    Post subject: Reply with quote

blitz wrote:
Is there anything in z/OS cobol to map julian dates to db2 iso date format?


Cobol has the intrinsic functions which can convert a julian date to gregorian date and vice versa.

Check this link

http://www.mvsforums.com/helpboards/viewtopic.php?p=10911#10911

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
blitz
Beginner


Joined: 24 Dec 2002
Posts: 28
Topics: 4

PostPosted: Tue Jan 23, 2007 9:35 am    Post subject: Reply with quote

Thanks a lot Kolusu. That is a very good solution. I came across both the functions while going through the manuals, but it never came across me to use a combination like that.. And next time, I'll make it a point to search in 'mainframe challenge' forum too. Embarassed
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming 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