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
|
Posted: Sat Jan 18, 2003 7:21 am Post subject: db2 date to julain date conversion |
|
|
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 |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
|
Posted: Sat Jan 18, 2003 8:44 am Post subject: |
|
|
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 |
|
|
mgjagadish Beginner
Joined: 18 Jan 2003 Posts: 13 Topics: 7 Location: 7/2,rams Apartments,Chennai1-14
|
Posted: Sun Jan 19, 2003 8:09 am Post subject: |
|
|
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 |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
|
Posted: Sun Jan 19, 2003 8:59 am Post subject: |
|
|
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 |
|
|
mgjagadish Beginner
Joined: 18 Jan 2003 Posts: 13 Topics: 7 Location: 7/2,rams Apartments,Chennai1-14
|
Posted: Mon Jan 20, 2003 8:52 am Post subject: |
|
|
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 |
|
|
blitz Beginner
Joined: 24 Dec 2002 Posts: 28 Topics: 4
|
Posted: Mon Jan 22, 2007 11:57 pm Post subject: |
|
|
Is there anything in z/OS cobol to map julian dates to db2 iso date format? |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
|
|
Back to top |
|
|
blitz Beginner
Joined: 24 Dec 2002 Posts: 28 Topics: 4
|
Posted: Tue Jan 23, 2007 9:35 am Post subject: |
|
|
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. |
|
Back to top |
|
|
|
|