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 - Sort - excluding dates

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: Syncsort - Sort - excluding dates
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 Moderator


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

PostPosted: Fri Oct 01, 2010 1:31 am    Post subject:
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    Post subject: Reply to: Sort - excluding dates
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    Post subject:
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: 578
Location: USA

PostPosted: Fri Oct 01, 2010 7:25 pm    Post subject:
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    Post subject:
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: 578
Location: USA

PostPosted: Fri Oct 01, 2010 7:44 pm    Post subject:
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    Post subject:
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: 578
Location: USA

PostPosted: Fri Oct 01, 2010 11:35 pm    Post subject:
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    Post subject:
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    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 How to change 'K' or 'M' use Sort vice_versa DFSORT/ICETOOL 5 Thu May 18, 2017 7:11 am
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
This topic is locked: you cannot edit posts or make replies. SORT trick needed bshkris SYNCSORT 6 Tue May 02, 2017 4:35 am
No new posts SORT JSON type of data maxsubrat DFSORT/ICETOOL 8 Wed Apr 19, 2017 6:01 pm
No new posts Sort Large record length cmsmoon DFSORT/ICETOOL 14 Tue Apr 11, 2017 5:49 pm


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