Page 1 of 1

grouping together records

PostPosted: Thu Jan 27, 2011 3:01 am
by cbf5516
I need to group together records based on a key in every record and then sort based upon a column value which would only be in one of the records.

I'll try to show an example and would appreciate if you could help me understand which commands would be best.

BA0001
BA0001
BA0001  02  Z15
BA0001
BA0002
BA0002  02  Z16
BA0002
BA0002
BA0003
BA0003  02  Z15
BA0003
BA0003

I would like to search the 02's and sort the entire number based upon the z value if possible. from what I see I'm running 1.3. Thank you for your time.

Re: grouping together records

PostPosted: Thu Jan 27, 2011 10:16 am
by MrSpock
I'm sorry, but what would be your expected output? And what is the RECFM and LRECL of the input dataset?

Re: grouping together records

PostPosted: Thu Jan 27, 2011 7:45 pm
by cbf5516
Thank you MrSpock. For my example the format would be vb and length would be 50.
The output I would want should look like the following:
BA0001
BA0001
BA0001 02 Z15
BA0001
BA0003
BA0003 02 Z15
BA0003
BA0003
BA0002
BA0002 02 Z16
BA0002
BA0002

I want to sort the entire file keeping the numbers grouped together, but have the sort by the z**. So the z15 id's should all come before the z16.

Re: grouping together records

PostPosted: Thu May 26, 2011 10:51 am
by pjagathis
Please post your clear sample input and output data..

Whether you want to group the records on first field and sort on third field???

Re: grouping together records

PostPosted: Thu May 26, 2011 1:21 pm
by NicC
I suspect that in the 4 months since the request either a solution was found or a change in requirements was made. Either way a post would have been nice so as to provide a clean end to the thread.