need to SORT a file which having 2 types of records



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

need to SORT a file which having 2 types of records

Postby jyothp12 » Fri Dec 30, 2011 1:47 pm

Hi,

I have a file like this.

1 jim124
4xrampun876
2xtomkol756
3 ken456

I need to sort this file which is having 2 types of records - one with space in 2nd position and another with 'x' in 2nd position.
The field from 6-8 pos in first rec is same as 9-11 in 2nd type ( suppose it is marks)

need to sort file with first filed ( which is roll num) and marks.

Please suggest a method

Thanks in advance
jyothp12
 
Posts: 13
Joined: Thu Dec 22, 2011 12:37 pm
Has thanked: 0 time
Been thanked: 0 time

Re: need to SORT a file which having 2 types of records

 

Re: need to SORT a file which having 2 types of records

Postby BillyBoyo » Fri Dec 30, 2011 2:20 pm

It can be done, but can you please give fuller information. RECFM, LRECL and start/length of the fields to be sorted on.

To sort on data that is in different positions, you need to get them into the same position. So, in the sort, you extend your record (at the end if fixed-length, at the beginning if variable) to define a field which is sourced from two different locations depending on type. You do this with INREC (which is before the data are sorted) and then specify that field (plus whatever else) on the SORT itself.

If you want to have a go at this yourself, please do and let us know how it goes. Otherwise I expect a solution will appear once you provide full information.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: need to SORT a file which having 2 types of records

Postby jyothp12 » Fri Dec 30, 2011 3:26 pm

Hi Bill

Thanks for ur reply..Im also planning to do the same, to PUSH the marks field to end and sort..hope it will work..
jyothp12
 
Posts: 13
Joined: Thu Dec 22, 2011 12:37 pm
Has thanked: 0 time
Been thanked: 0 time

Re: need to SORT a file which having 2 types of records

Postby BillyBoyo » Fri Dec 30, 2011 3:59 pm

Good for you. Let us know if you have any problems, or show your solution when you get it working, it can help others with the same sort of question later.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: need to SORT a file which having 2 types of records

Postby enrico-sorichetti » Fri Dec 30, 2011 4:27 pm

in IT terminology is crucial to good communication...

PUSH has a precise meaning in DFSORT literature and control statements

I guess that You really meant IFTHEN and OVERLAY
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 2643
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 130 times

Re: need to SORT a file which having 2 types of records

Postby Frank Yaeger » Fri Dec 30, 2011 11:48 pm

You didn't give the positions of your first field or the RECFM and LRECL of your input file, so I can't give you a complete solution. But here's a DFSORT job to sort on your marks field for an input data set with RECFM=FB and LRECL=80. Hopefully you can work out the rest yourself. If not, supply the missing information.

//S1 EXEC PGM=SORT                                           
//SYSOUT DD SYSOUT=*                                         
//SORTIN DD *                                               
1 jim124                                                     
4xrampun876                                                 
2xtomkol756                                                 
3 ken456                                                     
//SORTOUT DD SYSOUT=*                                       
//SYSIN DD *                                                 
  INREC IFTHEN=(WHEN=(2,1,CH,EQ,C' '),OVERLAY=(81:6,3)),     
        IFTHEN=(WHEN=NONE,OVERLAY=(81:9,3))                 
  SORT FIELDS=(81,3,CH,A)                                   
  OUTREC BUILD=(1,80)                                       


SORTOUT would have:

1 jim124         
3 ken456         
2xtomkol756       
4xrampun876       
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
User avatar
Frank Yaeger
Global moderator
 
Posts: 1080
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 14 times


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post