Adding number to records



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

Adding number to records

Postby Puffe » Wed Oct 26, 2011 1:02 am

Hello,

In my file I want to add a sequence number to all records but I want them to start with no 1 and grouped by the key.
The file i fixed blocked and recordlength is 10.
The key is the first five digits.

File consists of
12222ABCDE
12233ABDDE
12233JONES
12233ROSIE
13331HELLO
13331RONAN

The result should be
12222ABCDE0001
12233ABCDE0001
12233JONES0002
12233ROSIE0003
13331HELLO0001
13331RONAN0002

Anyone know how I accomplish this ?

Regards,

Mikael
Puffe
 
Posts: 21
Joined: Mon May 02, 2011 1:41 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Adding number to records

Postby Frank Yaeger » Wed Oct 26, 2011 1:15 am

You can use a DFSORT job like the following to do what you asked for:

//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
12222ABCDE
12233ABDDE
12233JONES
12233ROSIE
13331HELLO
13331RONAN
//SORTOUT DD SYSOUT=*
//SYSIN DD *
  OPTION COPY
  INREC IFTHEN=(WHEN=GROUP,KEYBEGIN=(1,5),PUSH=(11:SEQ=4))
/*


If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

http://www.ibm.com/support/docview.wss? ... g3T7000080
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: Adding number to records

Postby Puffe » Wed Oct 26, 2011 1:19 am

Thanks !

I'll try it when I get to work tomorrow
Puffe
 
Posts: 21
Joined: Mon May 02, 2011 1:41 pm
Has thanked: 0 time
Been thanked: 0 time


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post