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

Syncsort - Sort - excluding dates


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

New User


Joined: 03 Aug 2007
Posts: 27
Location: Florida

PostPosted: Thu Sep 30, 2010 11:47 pm
Reply with quote

I have a file with date format yy-mm-dd in column 2. I want to eliminate everytiing before the current date minus five days. How do I code this?
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Oct 01, 2010 1:31 am
Reply with quote

What is the starting position, length and format of the date field?

What is the RECFM and LRECL of the input file?

What is the century window for yy (e.g. 2000-2099 or 1980-2079 or what)?
Back to top
View user's profile Send private message
John Howard

New User


Joined: 03 Aug 2007
Posts: 27
Location: Florida

PostPosted: Fri Oct 01, 2010 4:26 pm
Reply with quote

1) Starting position = 2, length = 8, format = character, example: "10-09-30"

2) RECFM = FBA, LRECL = 131

3) Century window = 2000 to 2099
Back to top
View user's profile Send private message
prahalad

New User


Joined: 14 Sep 2010
Posts: 18
Location: Pune

PostPosted: Fri Oct 01, 2010 6:37 pm
Reply with quote

You can achieve this in 2 steps:
STEP1 : Using sort copy this file in a temporary file and append date part at the end of the each record in the Format YYYY-MM-DD. (hard coded "20" + "YY-MM-DD").
STEP2: Use the following sample code to include records satisfying the date condition: While creating the output file outrec only 131 bytes as no need the appended date part.

Code:

//STPU010   EXEC PGM=SORT                 
//SORTIN    DD *                         
2010-01-01                               
2010-10-01                               
2010-09-30                               
2010-09-29                               
2010-09-28                               
2010-09-27                               
2010-09-26                               
2010-09-25                               
//SORTOUT   DD SYSOUT=*                   
//SYSIN     DD *                         
 SORT FIELDS=COPY                         
 INCLUDE COND=(1,10,CH,GE,DATE1(-)-5)     
//SYSOUT   DD SYSOUT=*                   
//SORTMSG  DD SYSOUT=*                   
//SYSPRINT DD SYSOUT=*       


Explanation of INCLUDE COND=(1,10,CH,GE,DATE1(-)-5):
1: starting Position
10: Length
CH: Character Type
GE: greater than Equal to
DATE(-): "-" separated date
5: No of previous day from today
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 577
Location: USA

PostPosted: Fri Oct 01, 2010 7:25 pm
Reply with quote

John Howard,
See if below jcl works for you...
Code:

//SORT01   EXEC PGM=SORT                               
//SORTIN   DD  INPUT FBA/131                           
//SORTOUT  DD  OUTPUT FBA/131                           
//SYSIN DD *                                           
 OPTION Y2PAST=2000                                     
 INREC OVERLAY=(132:2,8,UFF,TO=ZD,LENGTH=6)             
 SORT FIELDS=COPY                                       
 OUTFIL OMIT=(132,6,Y2T,LT,Y'DATE1'-5),BUILD=(1,131)   
/*                                                     
//SYSOUT DD SYSOUT=*                                   
//*                                                                                                       


Thanks,
Back to top
View user's profile Send private message
John Howard

New User


Joined: 03 Aug 2007
Posts: 27
Location: Florida

PostPosted: Fri Oct 01, 2010 7:35 pm
Reply with quote

OPTION Y2PAST=2000
*
INREC OVERLAY=(132:2,8,UFF,TO=ZD,LENGTH=6)
SORT FIELDS=COPY
OUTFIL OMIT=(132,6,Y2T,LT,Y'DATE1'-5),BUILD=(1,131)
WER275A NO KEYWORDS FOUND ON CONTROL STATEMENT
WER449I SYNCSORT GLOBAL DSM SUBSYSTEM ACTIV[/list]
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 577
Location: USA

PostPosted: Fri Oct 01, 2010 7:44 pm
Reply with quote

John Howard,
You are using Syncsort and the solution I have provided was for DFSort.

Although, I don't have Syncsort but you may want to try below untested jcl...
Code:
//SORT01   EXEC PGM=SORT                               
//SORTIN   DD  INPUT FBA/131                           
//SORTOUT  DD  OUTPUT FBA/131                           
//SYSIN DD *                                           
 OPTION CENTWIN=2000                                     
 INREC OVERLAY=(132:2,8,UFF,TO=ZD,LENGTH=6)             
 SORT FIELDS=COPY                                       
 OUTFIL OMIT=(132,6,Y2T,LT,Y'DATE1'-5),BUILD=(1,131)   
/*                                                     
//SYSOUT DD SYSOUT=*                                   
//*           

OR
Code:
//SORT01   EXEC PGM=SORT                               
//SORTIN   DD  INPUT FBA/131                           
//SORTOUT  DD  OUTPUT FBA/131                           
//SYSIN DD *                                           
 OPTION CENTWIN=2000                                     
 INREC OVERLAY=(132:2,2,5,2,8,2)
 SORT FIELDS=COPY                                       
 OUTFIL OMIT=(132,6,Y2T,LT,Y'DATE1'-5),BUILD=(1,131)   
/*                                                     
//SYSOUT DD SYSOUT=*                                   
//*           

Thanks,
Back to top
View user's profile Send private message
John Howard

New User


Joined: 03 Aug 2007
Posts: 27
Location: Florida

PostPosted: Fri Oct 01, 2010 10:31 pm
Reply with quote

I was able to get it to work with some minor modifications: I moved the CENTWIN from the OPTIONS to the SORT statement and modified the record length fields by 1 byte. I'm guessing that the latter has to do with the FBA format.

//SYSIN DD *
INREC OVERLAY=(131:2,2,5,2,8,2)
SORT FIELDS=COPY,CENTWIN=2000
OUTFIL OMIT=(131,6,Y2T,LT,Y'DATE1'-5),BUILD=(1,130)
//

Thanks for your help,

John[/list]
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 577
Location: USA

PostPosted: Fri Oct 01, 2010 11:35 pm
Reply with quote

John Howard,
Glad that its working but in your earlier post you had mentioned that your input is LRECL 131. Why would you overlay 131st byte?

With the sortcard you have provided above, your output will be 130 lrecl.

Thanks,
Back to top
View user's profile Send private message
John Howard

New User


Joined: 03 Aug 2007
Posts: 27
Location: Florida

PostPosted: Sat Oct 02, 2010 12:03 am
Reply with quote

I'll go back and take another look.

Thanks yet again.

John
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 How to split large record length file... DFSORT/ICETOOL 10
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
No new posts how to calculate SUM value for VB fil... DFSORT/ICETOOL 1
Search our Forums:

Back to Top