Page 1 of 2

How to convert today's system date in to DDDDD format by JCL

PostPosted: Wed Dec 02, 2015 5:53 pm
by gauravnnl
Hi All,

I want to know, how to convert today's system date(YYYYMMDD) in DDDDD format by JCL/Sort card. My requirement is to delete records from the file which have transaction date older than 400 days from today's day, but transaction date is in DDDDD format.

My Approach---
In Step-1,I am thinking to get the system date via JCL and then convert it in DDDDD format.
In Step-2, I am thinking to subtract 400 days from DDDDD days(got from step1) and than use it to delete all the records from the file which have date less than this and write it to a new archived file.

Can anyone please help in this regard(If any sample JCL can be provided then much helpful).

Many Thanks,
Gaurav

Re: How to convert today's system date in to DDDDD format by

PostPosted: Wed Dec 02, 2015 6:39 pm
by Robert Sample
1. JCL cannot do this -- JCL does nothing but execute programs and allocate resources.
2. You'll need a program written in the language of your choice to do this. SORT might be able to do it, but there's not enough information to say for sure.
3. What is DDDDD format for a date? When you use terms specific to your site, such as DDDDD, you need to clearly explain what you are referring to. I assume it is the number of days since some base date but that's about all I can say from what you provided.

Re: How to convert today's system date in to DDDDD format by

PostPosted: Wed Dec 02, 2015 10:25 pm
by gauravnnl
A bit surprise to hear that this can't be done and thinking if a cobol program is really required to achieve this.
DDDDD is number of days from 1st Jan 1600 and i guess conversion from CCYYMMDD(todays system date) to DDDDD can be done using sort and later logic can be applied in sort to achieve the solution of above query.

Re: How to convert today's system date in to DDDDD format by

PostPosted: Wed Dec 02, 2015 10:34 pm
by NicC
It cannot be done by "JCL" - JCL does not manipulate data - it tells the OS what programs to run and what resources those programs require. Re-read Robert's answer - carefully.
You could probably do the whole thing in two sort steps - or one program in a language of your choice (but not JCL as it is not a programming language).

Re: How to convert today's system date in to DDDDD format by

PostPosted: Wed Dec 02, 2015 11:44 pm
by gauravnnl
Thnks Nic thts correct. Could you please show some insights or approach about these two sort steps. I don't want to write cobol programme and want to achieve this via sort only. Many thanks in advance !

Re: How to convert today's system date in to DDDDD format by

PostPosted: Thu Dec 03, 2015 5:03 am
by Akatsukami
As best I can determine, *sort has no support for a Julian[1], Lilian, or any similar day number. You may have to write a programette; to the left, I doubt that that's more than a couple hours' worth of effort.

[1] A real Julian day number, not an ordinal date.

Re: How to convert today's system date in to DDDDD format by

PostPosted: Thu Dec 03, 2015 5:21 pm
by NicC
Nope - I am not a sort guru.

Re: How to convert today's system date in to DDDDD format by

PostPosted: Mon Dec 07, 2015 8:05 am
by madooeiei
I don't want to write cobol programme and want to achieve this via sort only.

Re: How to convert today's system date in to DDDDD format by

PostPosted: Mon Dec 07, 2015 8:11 am
by Akatsukami
Once again: although *sort mavens as Mr. Boyo or Kolusu may devise some way of accomplishing it, I believe that it cannot be done. You will have to abandon your desire, or abandon the task.

Re: How to convert today's system date in to DDDDD format by

PostPosted: Tue Dec 15, 2015 4:13 pm
by Blackthorn
Rexx uses a base date of 1st January 0001. So working out the number of days between then and your base date and then subtracting that from the current Rexx date should be straightforward enough. That's 584,387 by my calculation, but you might want to double check that in case I've gone wrong somewhere with the number of leap years.

So, something like -

today = date('b') - 584387

Although the number of days since 1st January 1600 is > 99,999 so I'm not quite sure how that fits in to your DDDDD format.