IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

SYNCSORT date function


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
anand tr

New User


Joined: 12 Aug 2008
Posts: 41
Location: chennai

PostPosted: Thu Sep 04, 2008 6:46 pm
Reply with quote

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
View user's profile Send private message
anand tr

New User


Joined: 12 Aug 2008
Posts: 41
Location: chennai

PostPosted: Thu Sep 04, 2008 7:05 pm
Reply with quote

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
View user's profile Send private message
anand tr

New User


Joined: 12 Aug 2008
Posts: 41
Location: chennai

PostPosted: Thu Sep 04, 2008 7:16 pm
Reply with quote

Am using syncsort and the date format is ddmmyyyy
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Thu Sep 04, 2008 8:05 pm
Reply with quote

Sarting Position of Date please.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Thu Sep 04, 2008 8:18 pm
Reply with quote

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
View user's profile Send private message
anand tr

New User


Joined: 12 Aug 2008
Posts: 41
Location: chennai

PostPosted: Fri Sep 05, 2008 9:14 am
Reply with quote

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
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Fri Sep 05, 2008 10:01 am
Reply with quote

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
View user's profile Send private message
vinay kashyap

New User


Joined: 13 Aug 2008
Posts: 5
Location: US, california

PostPosted: Fri Sep 05, 2008 11:26 am
Reply with quote

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
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Fri Sep 05, 2008 12:21 pm
Reply with quote

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
View user's profile Send private message
anand tr

New User


Joined: 12 Aug 2008
Posts: 41
Location: chennai

PostPosted: Fri Sep 05, 2008 1:49 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Need to convert date format DFSORT/ICETOOL 20
No new posts Calling an Open C library function in... CICS 1
Search our Forums:

Back to Top