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

How to Sort only few records.


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
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
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
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
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
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Compare only first records of the fil... SYNCSORT 7
Search our Forums:

Back to Top