Portal | IBM Manuals | Downloads | Products | Refer | Info | Programs | JCLs | Forum Rules*| Site Map | Mainframe CD 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index
 
Register
 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index FAQ Search 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
Author Message
anand tr

New User


Joined: 12 Aug 2008
Posts: 38
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
References
Moved: Thu Sep 04, 2008 6:46 pm by superk From JCL to DFSORT/ICETOOL
anand tr

New User


Joined: 12 Aug 2008
Posts: 38
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: 38
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
Moved: Thu Sep 04, 2008 7:17 pm by superk From DFSORT/ICETOOL to JCL
Anuj D.

Global Moderator


Joined: 22 Apr 2006
Posts: 2221
Location: Phoenix, AZ

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 D.

Global Moderator


Joined: 22 Apr 2006
Posts: 2221
Location: Phoenix, AZ

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: 38
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
arcvns

Senior Member


Joined: 17 Oct 2006
Posts: 756
Location: Chennai, India

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
arcvns

Senior Member


Joined: 17 Oct 2006
Posts: 756
Location: Chennai, India

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: 38
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
Display posts from previous:   
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL All times are GMT + 6 Hours
Page 1 of 1