Page 1 of 1

To add seq number for each record to exisitng PS

PostPosted: Tue Jan 03, 2012 3:16 pm
by Mann_B
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,

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

PostPosted: Tue Jan 03, 2012 11:18 pm
by Frank Yaeger
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))
/*

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

PostPosted: Wed Jan 04, 2012 2:50 pm
by Mann_B
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.