View previous topic :: View next topic
|
Author |
Message |
anand tr
New User
Joined: 12 Aug 2008 Posts: 41 Location: chennai
|
|
|
|
I have a KSDS in which one of the field is out-date.
the requirement is to delete the records which dates back to an year old.
i.e i dont want the records which are older than an year. Can we compare the current run date and out-date? |
|
Back to top |
|
|
anand tr
New User
Joined: 12 Aug 2008 Posts: 41 Location: chennai
|
|
|
|
moving forward, i dont want a program to be used. do we have a date function in SORT itself? which compares the two dates ??
can any1 suggest me on this? |
|
Back to top |
|
|
anand tr
New User
Joined: 12 Aug 2008 Posts: 41 Location: chennai
|
|
|
|
Am using syncsort and the date format is ddmmyyyy |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
Sarting Position of Date please. |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
Hello again,
It should be noted that this kind of "suicide sort" is not recommended unless you can afford to lose the VSAM file if something goes wrong. It's safer to go from the VSAM file to a temporary file and then from the temporary file back to the VSAM file. |
|
Back to top |
|
|
anand tr
New User
Joined: 12 Aug 2008 Posts: 41 Location: chennai
|
|
|
|
hi anuj.. thanks for the suggestion..suppose we take a copy of the KSDS in a flat file , how can we go ahead comparing the dates using a JCL itself?shud we convert the dates into days? or there is any function in SORT which just compares the dates directly .?? |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
Anand,
You can directly filter the VSAM file using date functions available in SYNCSORT into a flat file and REPRO the flat file back into VSAM.
Thanks,
Arun |
|
Back to top |
|
|
vinay kashyap
New User
Joined: 13 Aug 2008 Posts: 5 Location: US, california
|
|
|
|
i hope you can try this.am not sure though as am new to mainframes
you can backup the KSDS into a flat file . i hope we can use sortcopy for that.
then u can use the flat file and REPRO the same into the KSDS.
include cond(50,10,ch,le,date1(/)+365).
sort fields=copy
well how is your date format? and wat about the seperators?
if any flaw, anyone please correct me. |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
Anand,
Here's a SYNCSORT job which filters records based on current date. I have assumed VSAM input, FB,LRECL=80 and the date(ddmmyyyy) starting at pos-5.
Code: |
//STEP00 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTOUT DD SYSOUT=*
//SORTIN DD DSN=Input-VSAM-file,DISP=SHR
//*
//SYSIN DD *
INREC OVERLAY=(81:9,4,7,2,5,2)
SORT FIELDS=COPY
OUTFIL OMIT=(81,8,CH,LT,&DATE1-365),BUILD=(1,80)
//* |
SORTIN
Code: |
---- +----1----+
0001 04082007
0002 04092008
0003 01092007
0004 05092007
0005 07092007
0006 04092007 |
SORTOUT
Code: |
000204092008
000405092007
000507092007 |
Thanks,
Arun |
|
Back to top |
|
|
anand tr
New User
Joined: 12 Aug 2008 Posts: 41 Location: chennai
|
|
|
|
Thanks for that Arun,
i just had a doubt whether the DATE1 function would work for ddmmyyyy format. but looking at your e.g it is cleared now. |
|
Back to top |
|
|
|