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



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

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

Postby gauravnnl » Wed Dec 02, 2015 5:53 pm

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
gauravnnl
 
Posts: 21
Joined: Tue Jul 15, 2014 2:25 pm
Has thanked: 3 times
Been thanked: 0 time

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

 

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

Postby Robert Sample » Wed Dec 02, 2015 6:39 pm

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.
Robert Sample
Global moderator
 
Posts: 3456
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 244 times

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

Postby gauravnnl » Wed Dec 02, 2015 10:25 pm

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.
gauravnnl
 
Posts: 21
Joined: Tue Jul 15, 2014 2:25 pm
Has thanked: 3 times
Been thanked: 0 time

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

Postby NicC » Wed Dec 02, 2015 10:34 pm

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).
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic

These users thanked the author NicC for the post:
gauravnnl (Wed Dec 02, 2015 11:44 pm)
NicC
Global moderator
 
Posts: 2755
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 110 times

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

Postby gauravnnl » Wed Dec 02, 2015 11:44 pm

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 !
gauravnnl
 
Posts: 21
Joined: Tue Jul 15, 2014 2:25 pm
Has thanked: 3 times
Been thanked: 0 time

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

Postby Akatsukami » Thu Dec 03, 2015 5:03 am

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.
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day
User avatar
Akatsukami
Global moderator
 
Posts: 1056
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 51 times

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

Postby NicC » Thu Dec 03, 2015 5:21 pm

Nope - I am not a sort guru.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 2755
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 110 times

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

Postby madooeiei » Mon Dec 07, 2015 8:05 am

I don't want to write cobol programme and want to achieve this via sort only.
madooeiei
 
Posts: 4
Joined: Mon Oct 12, 2015 2:53 pm
Has thanked: 0 time
Been thanked: 0 time

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

Postby Akatsukami » Mon Dec 07, 2015 8:11 am

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.
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day
User avatar
Akatsukami
Global moderator
 
Posts: 1056
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 51 times

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

Postby Blackthorn » Tue Dec 15, 2015 4:13 pm

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.
Blackthorn
 
Posts: 105
Joined: Tue Feb 01, 2011 7:12 pm
Has thanked: 0 time
Been thanked: 4 times

Next

Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post