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
 
Sort by date using syncsort

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

New User


Joined: 21 Aug 2006
Posts: 72

PostPosted: Thu Aug 26, 2010 8:32 am    Post subject: Sort by date using syncsort
Reply with quote

Hi All,

I have the below problem.

I have a 80 byte fb file. The records look like this,

Input
------
Code:
1 1129184420                 00000 
2 3159856786                 00001     
3 6756746546 20100723        00001
4 3157658372                 00001
2 5647456455                 00002 
3 6744565462 20100728        00002
3 3345252211 20100723        00002
4 3545325235                 00002
2 1526521431                 00003
3 5425364756 20100729        00003
3 5683452243 20100721        00003
3 7454632245 20100710        00003
4 6546325542                 00003
2 3465365476                 00004
3 3566888646 20100711        00004
4 3125363636                 00004   
5 8758567454                 00005

The Fourth field is a counter field where the counter value changes only when record 2 is encountered. Record 1 and 5 are header and trailer records respectively.

I want to sort the date (3rd field) which only occurs on record 3. Rest of the records should remain as it is. The order of the records should not changes.... record 3 should always come between 2 and 4. But in a sorted order by date.

Required Output
----------------

Code:
1 1129184420
2 3159856786
3 6756746546 20100723
4 3157658372
2 5647456455
3 3345252211 20100723
3 6744565462 20100728
4 3545325235
2 1526521431
3 7454632245 20100710
3 5683452243 20100721
3 5425364756 20100729
4 6546325542
2 3465365476
3 3566888646 20100711
4 3125363636
5 8758567454

Output i am getting
---------------------

Code:
1 1129184420
2 3159856786
4 3157658372
3 6756746546 20100723
2 5647456455
4 3545325235
3 3345252211 20100723
3 6744565462 20100728
2 1526521431
4 6546325542
3 7454632245 20100710
3 5683452243 20100721
3 5425364756 20100729
2 3465365476
4 3125363636
3 3566888646 20100711
5 8758567454

Can somebody help me achieve the required output. The input file is a 80 byte fb file. This needs to be done using syncsort .
Back to top
View user's profile Send private message

gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Thu Aug 26, 2010 9:33 am    Post subject:
Reply with quote

Hi,

Quote:
Output i am getting
---------------------
what do the SYSIN control statements look like to get your result ?


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

New User


Joined: 21 Aug 2006
Posts: 72

PostPosted: Thu Aug 26, 2010 9:45 am    Post subject:
Reply with quote

The Sysin include the below sort statement

sort fields=(30,5,CH,A,14,8,CH,A)

It first sorts on counter field to keep the record structure same as it is and then sorts on date field to sort record 3.

When sort of date field is done, since record 2 and 4 have spaces in the date field , after the sort they come one after the another. whereas there should always be a sorted record 3 in between them.
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Thu Aug 26, 2010 10:04 am    Post subject:
Reply with quote

Hi,

what about
Code:
SORT FIELDS=(30,5,CH,A,1,1,CH,A,14,8,CH,A)



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

New User


Joined: 21 Aug 2006
Posts: 72

PostPosted: Thu Aug 26, 2010 10:31 am    Post subject:
Reply with quote

Its looks like it'll work. I'll try tomorow and get back to you.

Thanks Gerry, u have been very helpful
Back to top
View user's profile Send private message
baljinders

New User


Joined: 21 Aug 2006
Posts: 72

PostPosted: Fri Aug 27, 2010 4:14 am    Post subject:
Reply with quote

Gerry,

It worked perfectly... Thanks a lot
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 sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm
No new posts JOINKEYS Paired and Unpaired Sort MFwhiz DFSORT/ICETOOL 4 Fri Sep 29, 2017 1:48 am
No new posts Compare yesterday's date to the one o... migusd SYNCSORT 11 Fri Sep 22, 2017 11:35 pm
No new posts Difference in SORT & ICETOOL Mohan Kothakota DFSORT/ICETOOL 5 Fri Sep 22, 2017 4:56 pm
No new posts Validate the Date girishb2 DFSORT/ICETOOL 9 Tue Sep 19, 2017 1:12 am

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