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
 

 

Sort file on two subsets of data

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
anandinmainframe

Active User


Joined: 31 May 2007
Posts: 171
Location: India

PostPosted: Wed Jul 11, 2012 11:15 am    Post subject: Sort file on two subsets of data
Reply with quote

Hi All,
This is my requirement,
I have an input file with the RCL of 516. i have to sort only the records which has 02,03 in the 20th position,(sorting should be done based on 20 & 516th position.) excluding the other records and sorting should be done such as 02 in descending and 03 in ascending. but the final output should be sorted based on 20th & 516 field, i.e) 01,02....11(20th position). Records will be in bunch as illustarted below i.e) 0AAA01 to 0QWE11 and again 0AAA01 to 0QWE11 the same.
Code:
        20                        516
0AAA01
0BBB02               
0BBB02                       A
0CCC03                       A
0CCC03                       
0CCC03                       
0DDD04
...
...
0QWE11
0AAA01
0BBB02               
0BBB02                       A
0CCC03                       A
0CCC03                       
0CCC03                       
0DDD04
...
...
0QWE11

i need the o/p as follows
Code:
        20                        516
0AAA01
0BBB02                        A
0BBB02                       
0CCC03                       
0CCC03                       
0CCC03                        A
0DDD04
...
...
0QWE11
0AAA01
0BBB02                        A
0BBB02                       
0CCC03                       
0CCC03                       
0CCC03                        A
0DDD04
...
...
0QWE11


Code'd and alignment of two A's guessed-at.
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7254

PostPosted: Wed Jul 11, 2012 1:31 pm    Post subject: Reply to: need help in sort
Reply with quote

You'd been here long enough to use the Code tags for posting.

You are saying you have two subsets of data in your file; they need to be sorted "in place", ie all the records in their new position will be in locations previously occupied by records of the same type in the same "group", the group only being defined by a number of consecutive records of that type; groups for one record type are to be sorted ascending, the other descending.

Is that about it?

Yes, it can be done if you confirm/explain.
Back to top
View user's profile Send private message
anandinmainframe

Active User


Joined: 31 May 2007
Posts: 171
Location: India

PostPosted: Wed Jul 11, 2012 2:10 pm    Post subject: Reply to: need help in sort
Reply with quote

Sorry for not posting in the code tag.
yes you are right.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7254

PostPosted: Wed Jul 11, 2012 2:34 pm    Post subject: Reply to: need help in sort
Reply with quote

You will need to create a new field for the sort key on your records.

For records that you want to stay the same, this needs to contain a record sequence-number.

Define a group for your required records. Use the record sequence-number of the group header for the first key, so all records in the group will have the same "sequence number".

Then you need a new field for your subset key. The ascending is easy. There are a number of ways to deal with the descending. Perhaps because your key is so short, just "invert". Define a field for the desceding key as binary, and subtract it from zero to give you the descending key for an ascending sort.

Sort on the two new keys.

Use OUTREC/OUTFIL BUILD to strip off the extra filekds.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Wed Jul 11, 2012 10:22 pm    Post subject:
Reply with quote

anandinmainframe,

How did a space record get sorted after 'A' ? If you are sorting on ASCENDING sequence , the space record will be the first record when sorted.

ex:

Code:

0BBB02       A
0BBB02         
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 -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Sorting group data rajella DFSORT/ICETOOL 1 Sun Jan 22, 2017 11:32 pm
No new posts SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
No new posts Storing huge volume of data, compare ... Pradeep K M All Other Mainframe Topics 3 Mon Jan 16, 2017 5:08 pm
No new posts how to recover an uncataloged VSAM da... archanamuthukrishnan All Other Mainframe Topics 3 Wed Jan 11, 2017 6:18 pm
No new posts HALDB data refresh/copy from producti... vineetanand2007 IMS DB/DC 1 Mon Jan 02, 2017 11:16 am


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