To add seq number for each record to exisitng PS



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

To add seq number for each record to exisitng PS

Postby Mann_B » Tue Jan 03, 2012 3:16 pm

I am Having an Input file as below with ascending sequence number(cols 3 - 7) and some with dupe records from COl- 9.
Is there any chance to create new output file by eliminating dupes records from Col-9 from input file and sequence number should be in correct order in output file.


Please let me know for any more details required.
INPUT FILE :
----+----1----+----2----+----3
00
0100001 1111111111111111111111111 X
0100002 1111111111111111111111111 X
0100003 1111111111111111111111111 X
0100004 2222222222222222222222222 Y
0100005 3333333333333333333333333 Z
0100006 4444444444444444444444444 X
0100007 4444444444444444444444444 X
0100008 5555555555555555555555555 Y
0100009 6666666666666666666666666 Y
0100010 7777777777777777777777777 Y
0100011 8888888888888888888888888 X
0100012 8888888888888888888888888 X
0100013 9999999999999999999999999 Z
09 000000013


OUTPUT FILE

----+----1----+----2----+----3
00
0100001 1111111111111111111111111 X
0100002 2222222222222222222222222 Y
0100003 3333333333333333333333333 Z
0100004 4444444444444444444444444 X
0100005 5555555555555555555555555 Y
0100006 6666666666666666666666666 Y
0100007 7777777777777777777777777 Y
0100008 8888888888888888888888888 X
0100009 9999999999999999999999999 Z
09 000000009

Thanks,
Mann_B
 
Posts: 79
Joined: Wed Mar 31, 2010 11:48 am
Has thanked: 0 time
Been thanked: 0 time

Re: To add seq number for each record to exisitng PS

 

Re: To add seq number for each record to exisitng PS

Postby Frank Yaeger » Tue Jan 03, 2012 11:18 pm

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

//S1    EXEC  PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
00
0100001 1111111111111111111111111 X
0100002 1111111111111111111111111 X
0100003 1111111111111111111111111 X
0100004 2222222222222222222222222 Y
0100005 3333333333333333333333333 Z
0100006 4444444444444444444444444 X
0100007 4444444444444444444444444 X
0100008 5555555555555555555555555 Y
0100009 6666666666666666666666666 Y
0100010 7777777777777777777777777 Y
0100011 8888888888888888888888888 X
0100012 8888888888888888888888888 X
0100013 9999999999999999999999999 Z
09 000000013
//SORTOUT DD SYSOUT=*
//SYSIN DD *
  OPTION EQUALS
  OMIT COND=(1,2,CH,EQ,C'09')
  SORT FIELDS=(1,2,CH,A,9,25,CH,A)
  SUM FIELDS=NONE
  OUTREC IFTHEN=(WHEN=(1,2,CH,EQ,C'01'),OVERLAY=(3:SEQNUM,5,ZD))
  OUTFIL REMOVECC,TRAILER1=('09 ',COUNT-1=(M11,LENGTH=9))
/*
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

Re: To add seq number for each record to exisitng PS

Postby Mann_B » Wed Jan 04, 2012 2:50 pm

Thank u for quick reply

Its working , I customized ur code as per my requirement :).Here I learnt much more about sort usage thank u once again.
Mann_B
 
Posts: 79
Joined: Wed Mar 31, 2010 11:48 am
Has thanked: 0 time
Been thanked: 0 time


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post