Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

SYNCSORT date function

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: SYNCSORT date function
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    Post subject:
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    Post subject:
Reply with quote

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

Senior Member


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

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

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

Senior Member


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

PostPosted: Thu Sep 04, 2008 8:18 pm    Post subject:
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    Post subject:
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: 2180
Location: @my desk

PostPosted: Fri Sep 05, 2008 10:01 am    Post subject:
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    Post subject:
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: 2180
Location: @my desk

PostPosted: Fri Sep 05, 2008 12:21 pm    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Syncsort Help to group fields sudhakarraju SYNCSORT 6 Thu Dec 29, 2016 1:38 am
No new posts syncsort: copy lines after the keyword shreya19 SYNCSORT 7 Fri Dec 02, 2016 9:47 am
This topic is locked: you cannot edit posts or make replies. RANDOM Function in COBOL swapnil781 COBOL Programming 2 Tue Nov 15, 2016 6:17 pm
No new posts TOT & DATE parameter in ICEMAN hemanthj642 DFSORT/ICETOOL 4 Mon Nov 14, 2016 5:19 am
No new posts Check System time(Minute) Using TIME1... balaji81_k DFSORT/ICETOOL 5 Fri Nov 11, 2016 10:53 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us