Sort the records of the dataset except it's first records?



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

Sort the records of the dataset except it's first records?

Postby vmahaja1 » Wed Dec 17, 2008 10:29 am

How can I sort the records of the dataset except it's first records? The output file should contain the first record as it is and rest in sorted order.

Thanks in advance.
vmahaja1
 
Posts: 3
Joined: Wed Dec 17, 2008 10:10 am
Has thanked: 0 time
Been thanked: 0 time

Re: DFSORT

Postby Frank Yaeger » Wed Dec 17, 2008 10:34 pm

You can use the new DATASORT operator of DFSORT's ICETOOL, available with z/OS DFSORT V1R5 PTF UK90013 (July, 2008) to do that quite easily. If you don't have that PTF, ask your System Programmer to install it (it's free). Here's an example - you didn't give the sort fields you want to use, so I'll assume it's 1,4,CH,A. Change the SORT statement as needed.

//S1   EXEC  PGM=ICETOOL                           
//TOOLMSG   DD  SYSOUT=*                           
//DFSMSG    DD  SYSOUT=*                           
//IN DD *                                           
FIRST                                               
AAAA                                               
CCCC                                               
DDDD                                               
FFFF                                               
GGGG                                               
//OUT DD SYSOUT=*                                   
//TOOLIN DD *                                       
DATASORT FROM(IN) TO(OUT) FIRST USING(CTL1)         
/*                                                 
//CTL1CNTL DD *                                     
  SORT FIELDS=(1,4,CH,A)                           
/*


OUT would have:

FIRST   
AAAA   
CCCC   
DDDD   
FFFF   
GGGG   


For complete details on the new DATASORT function and the other new functions available with PTF UK90013, see:

http://www.ibm.com/systems/support/stor ... /mvs/ugpf/
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: 1079
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 15 times

Re: DFSORT

Postby vmahaja1 » Thu Dec 18, 2008 10:16 am

Frank,
Thank you for ur quick reply. But actully my file is in following format.

1 ---- ---
3 ------------
5---nbr3
5---nbr1
5---nbr5
5---nbr2

7 ------------
3 ------------
5---nbr0
5---nbr4
5---nbr8
5---nbr7
------------
9 ------------------------------

I want to sort only block of records with type 5 on the basis of nbr#. Position of records with typr 1,3, 7 should remain same.

Thanks in advance.
vmahaja1
 
Posts: 3
Joined: Wed Dec 17, 2008 10:10 am
Has thanked: 0 time
Been thanked: 0 time

Re: DFSORT

Postby Frank Yaeger » Thu Dec 18, 2008 10:54 pm

vmahaja1,

Here's a DFSORT job that will work for your new requirement. You'll still need z/OS DFSORT V1R5 PTF UK90013 (July, 2008) to use WHEN=GROUP. I assumed your input file has RECFM=FB and LRECL=80, but the job can be changed accordingly. In the future, please describe your "real" requirement in your first post to avoid wasting peoples' time.

//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=...  input file (FB/80)
//SORTOUT DD DSN=...  output file (FB/80)
//SYSIN DD *
  OPTION EQUALS
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,1,CH,EQ,C'3'),
    PUSH=(81:ID=8))
  SORT FIELDS=(81,8,ZD,A,1,1,CH,A,5,4,CH,A)
  OUTREC BUILD=(1,80)
/*
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: 1079
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 15 times


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post