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
 

 

How to Sort only few records.

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

New User


Joined: 18 Aug 2003
Posts: 4

PostPosted: Wed Nov 25, 2009 12:23 pm    Post subject: How to Sort only few records.
Reply with quote

Hi,

My file which VB of record length 212 has data arranged in the following way

Code:
1AAA123
2AAA123
2AAA123
2AAA123
3AAA123
3AAA123001
3AAA123001
3AAA123001
3AAA123002
3AAA123002
3AAA123002
43AAA123
53AAA123


I wan't sort only the reocrds which have "3" in position 1(Type 3 records) and sort 1:10 and remove the duplicates using SUM FIELDS=NONE.

My Out put after the sort should be
Code:
1AAA123
2AAA123
2AAA123
2AAA123
3AAA123
3AAA123001
3AAA123002
43AAA123
53AAA123


Do any one have any easy way to do this in single cnotrol card using IF THEN in SYNC SORT
Back to top
View user's profile Send private message

karisurya

New User


Joined: 02 Aug 2007
Posts: 64
Location: Bangalore

PostPosted: Wed Nov 25, 2009 4:08 pm    Post subject:
Reply with quote

Hi Shasi,
Seeing the way your input is i have one quick question why you want to sort only records with value "3" in 1st position. Can you tell your actual business requirement, because seeing the exisint data i dont see a reason to specifically put that condition.
Back to top
View user's profile Send private message
darkstar13

New User


Joined: 06 Nov 2008
Posts: 46
Location: Manila, Philippines

PostPosted: Thu Nov 26, 2009 7:55 am    Post subject: Reply to: How to Sort only few records.
Reply with quote

Hi,
If your file is FB, 80:
Code:
//SYSIN    DD    *                                           
  SORT FIELDS=(81,13,CH,A)                                   
  INREC IFTHEN=(WHEN=(1,1,CH,EQ,C'3'),OVERLAY=(81:1,1,       
                                               82:C'99',     
                                               84:1,10)),     
        IFTHEN=(WHEN=(1,1,CH,NE,C'3'),OVERLAY=(81:1,1,       
                                               82:SEQNUM,2,ZD,
                                               84:1,10))     
  SUM FIELDS=NONE                                             
  OUTREC FIELDS=(1,80)       

but since your file is VB, you have to consider RDW.
as for the overlay part, i am not sure how to do this is the file is VB.
maybe you can overlay on the fixed portion that will always have empty entries (or filler fields)..

can you give us the layout of your VB file?
Back to top
View user's profile Send private message
anvesh

New User


Joined: 26 Nov 2009
Posts: 2
Location: hyderabad

PostPosted: Thu Nov 26, 2009 2:58 pm    Post subject: description for this post
Reply with quote

can you please describe the solution you provided
Back to top
View user's profile Send private message
darkstar13

New User


Joined: 06 Nov 2008
Posts: 46
Location: Manila, Philippines

PostPosted: Fri Nov 27, 2009 7:39 am    Post subject: Reply to: How to Sort only few records.
Reply with quote

Hi anvesh,

I created a temporary sort key which consists of:
1. The first byte - since we need to sort ALL records by the first byte
2. A sequence number - I set this to 99 (or any fixed number) so that it WON'T be unique for records with '3' on the first byte, and SEQNUM for the rest. This will make the non '3' records unique, since we don't want the dups for these records removed.
3. The 10-byte sort key - for removing the dups.

I hope that clarified my solution. Senior SORT people would probably give a better solution.
Back to top
View user's profile Send private message
anvesh

New User


Joined: 26 Nov 2009
Posts: 2
Location: hyderabad

PostPosted: Fri Nov 27, 2009 10:01 am    Post subject: Reply to: How to Sort only few records.
Reply with quote

Hi dude,

Many thanks for the quick reply and description provided. icon_biggrin.gif
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 to unpack a feild shr_amar DFSORT/ICETOOL 7 Fri Jul 07, 2017 4:32 am
No new posts How to write Specific Fields from Mul... Padhu SYNCSORT 6 Thu Jul 06, 2017 10:26 am
No new posts Optimize sort inrec parse vishwakotin DFSORT/ICETOOL 6 Mon Jun 26, 2017 11:15 pm
No new posts Reduce CPU Times for Join Sort santoshn SYNCSORT 12 Sat Jun 10, 2017 1:40 pm
No new posts Db2 load job abending in SORT mistah kurtz DB2 4 Mon Jun 05, 2017 3:58 pm


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