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

Sort by date using syncsort


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
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
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: 1702
Location: Australia

PostPosted: Thu Aug 26, 2010 9:33 am
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
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: 1702
Location: Australia

PostPosted: Thu Aug 26, 2010 10:04 am
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
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
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 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 8
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
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 Need to convert date format DFSORT/ICETOOL 20
Search our Forums:

Back to Top