Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Sorting the file base on the date range

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
Select-mf

New User


Joined: 11 May 2007
Posts: 42
Location: bangalore

PostPosted: Sat Mar 14, 2009 3:21 am    Post subject: Sorting the file base on the date range
Reply with quote

Hi,

My requirement is to sort file based on the date range, I am using Syncsort in my shop. The date is defined as yyyymmdd in my input file.

I want in my output file, only the records with the date range falling between 19980801 to 20041231.

How can I achieve this using Syncsort in JCL?

Thanks.
Back to top
View user's profile Send private message

dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Sat Mar 14, 2009 4:15 am    Post subject:
Reply with quote

Hello,

Use INCLUDE for values between the lo/hi values. Or with OMIT to exclude. Either will work unless i misunderstand something.

The sort doesn't need to know they are dates, just that you want to work with values between those given.
Back to top
View user's profile Send private message
Select-mf

New User


Joined: 11 May 2007
Posts: 42
Location: bangalore

PostPosted: Sun Mar 15, 2009 10:11 am    Post subject: Reply to: Sorting the file base on the date range
Reply with quote

Hi,

Ok...so you mean to say date is just like any other field. But I do not know how to give the range in sort card using include/omit.

Can anybody please give me an example, so that I can try on my system?

Thanks.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Sun Mar 15, 2009 10:43 am    Post subject:
Reply with quote

Hello,

Quote:
so you mean to say date is just like any other field
In your posted example, yes it is just like anyother field.

This would be a good time to become more familiar with the forum SEARCH (which searches only topics within the forum).

There are several examples of include or omit in the forum.

If you are actually going to sort the file, you will need to include the actual sort control statements.

To process the records you want (records between 19980801 and 20041231) you would use something like:
Code:
(s,8,CH,GT,C'19980800',AND,s,8,CH,LT,C'20041232')
Note that i've used non-dates to set the ends of the range. This will not matter as the process is merely looking at values not actual dates.
Back to top
View user's profile Send private message
Select-mf

New User


Joined: 11 May 2007
Posts: 42
Location: bangalore

PostPosted: Mon Mar 16, 2009 8:40 am    Post subject: Reply to: Sorting the file base on the date range
Reply with quote

Hi,

I tried the below sort card in my JCL but I got an error in spool as below -

Code:
SYSIN :                                                       
   SORT FIELDS=COPY                                           
   INCLUDE COND=(113,8,CH,GT,19980801,AND,113,8,CH,LT,99999999)
                             *                                 
WER253A  INCLUDE/OMIT FORMATS INCOMPATIBLE
"Code"d
The date field starts at 113th position in my input file.

Thanks.
Back to top
View user's profile Send private message
Select-mf

New User


Joined: 11 May 2007
Posts: 42
Location: bangalore

PostPosted: Mon Mar 16, 2009 8:43 am    Post subject: Reply to: Sorting the file base on the date range
Reply with quote

Hi,

The error (*) is showing just below the date(19980801) in spool, while pasting it on the above reply it vent below Include.

Thanks.
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Mon Mar 16, 2009 8:53 am    Post subject:
Reply with quote

Hi,

see Dick's example again, the date should be like this when using CH,

Code:
C'19980800'



Gerry
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Mon Mar 16, 2009 9:18 am    Post subject:
Reply with quote

Hello,

As Gerry mentions, character fields need quotes.

Also, please note that your sort control has been "Code"d for readability. Also note that using the "Code" tag preserves alignment. Use the Preview to see your post the way it will appear to the forum and when you are satisfied, Submit.
Back to top
View user's profile Send private message
Select-mf

New User


Joined: 11 May 2007
Posts: 42
Location: bangalore

PostPosted: Mon Mar 16, 2009 11:39 am    Post subject: Reply to: Sorting the file base on the date range
Reply with quote

Hi,

Thanks, its working. I will put the code tag going forward.

Thanks again to both of you.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Mon Mar 16, 2009 11:54 am    Post subject: Reply to: Sorting the file base on the date range
Reply with quote

You're welcome - thanks for letting us know it is working icon_smile.gif

d
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 Execute JCL step based on the content... sprikitik JCL & VSAM 2 Tue Oct 03, 2017 10:03 am
This topic is locked: you cannot edit posts or make replies. PS file data should be passed as symb... d_sarlie JCL & VSAM 15 Tue Oct 03, 2017 5:18 am
No new posts Garbage on output file Hervey Martinez SYNCSORT 4 Wed Sep 27, 2017 12:50 am
No new posts File Aid tool to compare numeric data balaji81_k Compuware & Other Tools 2 Tue Sep 26, 2017 3:35 am
No new posts Compare yesterday's date to the one o... migusd SYNCSORT 11 Fri Sep 22, 2017 11:35 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us