How to subtract days from a date using days



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

How to subtract days from a date using days

Postby coollearner » Thu Jun 09, 2011 12:15 pm

I have the following dates in a file:
16011986
17011986
18011986
19011986
20011986

I want to subtract 1034 days from all these days. please let me know how to do this.
Knowledge is wealth
coollearner
 
Posts: 33
Joined: Thu Jun 03, 2010 3:15 pm
Has thanked: 0 time
Been thanked: 0 time

Re: How to subtract days from a date using days

 

Re: How to subtract days from a date using days

Postby Frank Yaeger » Thu Jun 09, 2011 10:27 pm

What is the format of the date? Is it ddmmyyyy or something else (what)?

What is the RECFM and LRECL of the input file?
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
User avatar
Frank Yaeger
Global moderator
 
Posts: 1080
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 14 times

Re: How to subtract days from a date using days

Postby coollearner » Fri Jun 10, 2011 12:26 pm

Frank Yaeger wrote:What is the format of the date? Is it ddmmyyyy or something else (what)?

What is the RECFM and LRECL of the input file?



The format is ddmmyyyy
RECFM is FB
LRECL is 80
Knowledge is wealth
coollearner
 
Posts: 33
Joined: Thu Jun 03, 2010 3:15 pm
Has thanked: 0 time
Been thanked: 0 time

Re: How to subtract days from a date using days

Postby Frank Yaeger » Fri Jun 10, 2011 9:11 pm

You can use a DFSORT job like the following to do what you asked for:

//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
16011986
17011986
18011986
19011986
20011986
//SORTOUT DD SYSOUT=*
//SYSIN DD *
  OPTION COPY
* Convert from ddmmyyyy to yyyymmdd
  INREC IFTHEN=(WHEN=INIT,BUILD=(5,4,3,2,1,2)),
* Get yyyymmdd - 1034 days
    IFTHEN=(WHEN=INIT,BUILD=(1,8,Y4T,SUBDAYS,+1034,TOGREG=Y4T)),
* Convert from yyyymmdd to ddmmyyyy
    IFTHEN=(WHEN=INIT,BUILD=(7,2,5,2,1,4,80:X))
/*


SORTOUT would have:

19031983   
20031983   
21031983   
22031983   
23031983   
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
User avatar
Frank Yaeger
Global moderator
 
Posts: 1080
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 14 times

Re: How to subtract days from a date using days

Postby jvinoth » Thu Jan 19, 2012 12:27 pm

hi frank can you please tell me what is the use of Y4T in the condition...I am new to mainframe so please explain me
jvinoth
 
Posts: 132
Joined: Fri Nov 18, 2011 3:13 pm
Has thanked: 0 time
Been thanked: 1 time

Re: How to subtract days from a date using days

Postby NicC » Thu Jan 19, 2012 8:20 pm

If you look at Frank's signature or the sticky topics at the top of this section of the forum you would find the necessary references to enable you to find out these things on your own. Frank, being the kind soul that he is, may come back with the exact reference that you need. But... doing the reading yourself will lead you to the other wonders of DFSort. (Sorry - on holiday and waxing lyrical!)
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 2751
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 subtract days from a date using days

Postby Akatsukami » Thu Jan 19, 2012 8:36 pm

NicC wrote:(Sorry - on holiday and waxing lyrical!)

Well don't let the wax contaminate the groundwater! :mrgreen:
"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 subtract days from a date using days

Postby skolusu » Thu Jan 19, 2012 10:06 pm

jvinoth,

Check this link which explains DFSORT Data Formats

If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

http://www.ibm.com/support/docview.wss? ... g3T7000080
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
skolusu
 
Posts: 586
Joined: Wed Apr 02, 2008 10:38 pm
Has thanked: 0 time
Been thanked: 39 times

Re: How to subtract days from a date using days

Postby Frank Yaeger » Thu Jan 19, 2012 11:48 pm

jvinoth,

For specific information on DFSORT functions that use the Y4x formats, you can also see these papers:

http://www.ibm.com/support/docview.wss? ... g3T7000174

http://www.ibm.com/support/docview.wss? ... g3T7000242
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
User avatar
Frank Yaeger
Global moderator
 
Posts: 1080
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 14 times

Re: How to subtract days from a date using days

Postby jvinoth » Fri Jan 20, 2012 2:29 pm

thank you so much..
jvinoth
 
Posts: 132
Joined: Fri Nov 18, 2011 3:13 pm
Has thanked: 0 time
Been thanked: 1 time

Next

Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post